Jump to content
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

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.

×
×
  • Create New...