Paolo Posted February 5, 2019 Share Posted February 5, 2019 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. Quote Link to comment
Julian Carr Posted February 5, 2019 Share Posted February 5, 2019 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. 2 Quote Link to comment
Paolo Posted February 5, 2019 Author Share Posted February 5, 2019 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; … Quote Link to comment
Paolo Posted February 5, 2019 Author Share Posted February 5, 2019 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. Quote Link to comment
Julian Carr Posted February 5, 2019 Share Posted February 5, 2019 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. Quote Link to comment
Recommended Posts
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.