Jump to content
Developer Wiki and Function Reference Links Read more... ×
Paolo

Symbol embedded in plugin (but not drawn!)

Recommended Posts

Hello experts,
I have developed a plugin object that takes advantage of a particular symbol to get from it the polyline it contains.
If I copy / paste this object on another drawing, the symbol is not copied, because it is not actually drawn in the object, it is just used to get the polyline.
Is there a way to embed the symbol inside the object without the need to draw it?

Thank you for any help.

Share this post


Link to post

You need to add a symbol instance to the profile group of the PIO using SetCustomObjectProfileGroup(). Because this is persistent between regens, you need to delete the profile group on each regen then reinstate it. Something like this:


            Symbol('mysymbol', 0, 0, 0);
            h1 := LNewObject;
            h2 := GetCustomObjectProfileGroup(ghParm);
            IF h2 <> Nil THEN DelObject(h2);
            IF h1 = NIL THEN Flag := SetCustomObjectProfileGroup(ghParm, h2)

 

You can always check the existence of the profile group by selecting your object then using the Edit Group command.

  • Like 2

Share this post


Link to post

Thank you,

I have tried in the reset event (I am in an event driven plugin), but the symbol appears on the drawing…

 

this is my code, PFILESCELTO is the symbol name, I have to check if it is on the drawing

…
    parmName := 'BAD';
    parmHand := nil;
    parmRecordHand := nil;
    wallHand := nil;
    primoPassaggio := TRUE;
    
    resultStatus := GetCustomObjectInfo(parmName, parmHand, parmRecordHand, wallHand);
    
    IF (resultStatus = TRUE) AND (parmHand <> NIL) AND (parmRecordHand <> NIL) THEN BEGIN
    
    if GetObject(PFILESCELTO) <> NIL then 
    begin
        symbol(PFILESCELTO, 0, 0, 0);
        h1 := LNewObj;
        h2 := GetCustomObjectProfileGroup(parmHand);
        IF h2 <> Nil THEN DelObject(h2);
        IF h1 = NIL THEN result := SetCustomObjectProfileGroup(parmHand, h2);
    end;
…

 

Share this post


Link to post

Solved!

 

Julian code needed only some retouch, the idea was right!

The correct procedure (at least it works for my purposes) is as follows:

…
resultStatus := GetCustomObjectInfo(parmName, parmHand, parmRecordHand, wallHand);
	
	IF (resultStatus = TRUE) AND (parmHand <> NIL) AND (parmRecordHand <> NIL) THEN BEGIN
	
	if GetObject(PFILESCELTO) <> NIL then 
	begin
		symbol(PFILESCELTO, 0, 0, 0);
		h1 := LNewObj;
		h2 := GetCustomObjectProfileGroup(parmHand);
		IF h2 <> Nil THEN DelObject(h2);
		result := SetCustomObjectProfileGroup(parmHand, h1);
	end;
…

In this way the symbol is not visible in the PIO representation, but is embedded and thus, copy / paste, of the object will include the symbol itself.

Share this post


Link to post

Glad you got it working. Apart from copying and pasting between files, this functionality also ensures that the symbol is seen as being in-use by the Purge command, so won't get accidentally deleted.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×