MaxStudio Posted October 5, 2011 Share Posted October 5, 2011 Anyone know a way to create two different plugin objects that utilize a common parameter? I want to be able to create an object (objectA) and another object (objectB). I need a way to link objectA and objectB together. Once they are linked I would like them to be able to utilize a common parameter, such as, the object width. This way if I change the width of objectA the width of objectB changes as well. Any ideas? Thanks in Advance Derek Quote Link to comment
VincentCuclair Posted October 5, 2011 Share Posted October 5, 2011 I guess you need to be more specific on what kind of object you mean eg. How complex? Quote Link to comment
Dieter @ DWorks Posted October 5, 2011 Share Posted October 5, 2011 When changing the width of objectA, you can code the change of objectB and vica versa. You'll have to use an extra parameter to make sure that this doesn't loop. Quote Link to comment
MaxStudio Posted October 5, 2011 Author Share Posted October 5, 2011 DWorks, but how would I go about referencing an outside plugin object in my script? Is there a way to give the plugin object a name once it is created? I have a plugin object that creates a window in plan. I also have a plugin object that creates a window in elevation. I want to be able to change the width of the window in plan and have it also change the width of the window in elevation. and vice versa. This means I need to be able to create each object seperately and then i need to be able to link the two (using a parameter or a name) is it possible or is there a better way to do this? Quote Link to comment
Miguel Barrera Posted October 5, 2011 Share Posted October 5, 2011 To expand on Dieter logic, you need to compare previous with current width to reset the other object and prevent it from looping back and forth. IF prevWdt <> currWdt THEN BEGIN SetRField(obj2Hdl,obj2Name,obj2FieldPrev,Num2Str(4,currWdt)); SetRField(obj2Hdl,obj2Name,obj2FieldCurr,Num2Str(4,currWdt)); ResetObject(obj2Hdl); END; If the updating is only one-way then you only need to set the new width on the other object SetRField(obj2Hdl,obj2Name,obj2FieldCurr,Num2Str(4,currWdt)); ResetObject(obj2Hdl); Quote Link to comment
JBenghiat Posted October 5, 2011 Share Posted October 5, 2011 You need to assign a unique ID for both objects. If you assign the UID to the object's name, it is easy to retrieve a handle using GetObject You would store the UIDs of the linked objects in something like a 'link to' parameter, which you probably want to lock or hide. You can use object event handling to know when a specific parameter has changed. If so, you would use setRField to copy the dimensions to the other object. You would also set something like a fromLink Boolean field to true in the linked object. So: If fromLink set fromLink param false else updateLinkedObject; That would prevent a loop of the objects updating each other.. -Josh Quote Link to comment
MaxStudio Posted October 5, 2011 Author Share Posted October 5, 2011 ok so here you are saying I need to have a record created. I store the width in one of the record fields. The objects reference the record to obtain the width. when I change the width of objectA it changes the width of the field in the record therefore changing the width of objectB? Next question, how do i create the record? and how do I get both objects to reference the same record? Quote Link to comment
JBenghiat Posted October 5, 2011 Share Posted October 5, 2011 VectorScript can access parametrs as records. The record name is the PIO name. Quote Link to comment
Miguel Barrera Posted October 5, 2011 Share Posted October 5, 2011 Next question, how do i create the record? and how do I get both objects to reference the same record? All pio's already have a record with the same name as the pio. You only need to add a hidden parameter to the pio's list. The alternative method as discussed before, which is more complicated, is to use the event handling feature where VS tells you which parameter has changed. Quote Link to comment
Dieter @ DWorks Posted October 5, 2011 Share Posted October 5, 2011 DWorks, but how would I go about referencing an outside plugin object in my script? Is there a way to give the plugin object a name once it is created? I have a plugin object that creates a window in plan. I also have a plugin object that creates a window in elevation. I want to be able to change the width of the window in plan and have it also change the width of the window in elevation. and vice versa. This means I need to be able to create each object seperately and then i need to be able to link the two (using a parameter or a name) is it possible or is there a better way to do this? You can let VS search for the object by plugin name and check for a field value, like a window id. This way, you can have more than two objects linked, like when you have multiple windows that are the same. Quote Link to comment
MaxStudio Posted October 6, 2011 Author Share Posted October 6, 2011 Is the name used in the script the same name i give the plugin in the VectorScript Plug-in Editor? If so, how do i differentiate between 2 different objects create with the same plugin tool. Example: I create one window in plan using the plugin. Its with will be 24". I then create a window in elevation that is linked to the window in plan. Its with is 24". I now want to create a new window in plan that will be 36". Will there be issues with the width if I create this new 36" window? Sorry if I'm confusing you folks. I am always trying to work these things out on my own and appreciate the help. Thanks Derek Quote Link to comment
MaxStudio Posted October 6, 2011 Author Share Posted October 6, 2011 or is the name the name given when i use: GetCustomObjectInfo(objectName :STRING;objectHand :HANDLE; recordHand :HANDLE;wallHand :HANDLE) :BOOLEAN; Quote Link to comment
Dieter @ DWorks Posted October 7, 2011 Share Posted October 7, 2011 The name is the name of the plug-in object. To identify a certain object, you must have a parameter that you set to something. Then you can search of all objects of the same plug-in, and search the one or ones with a certain value of the parameter. 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.