spettitt Posted November 5, 2025 Share Posted November 5, 2025 I'm working on a custom PIO for a facility panel. What I would like is to have the ability in the OIP for the user to select a ConnectCAD Panel Layout style from their current file and have it shown on the front of the panel. Is it possible to create an instance of another PIO inside my custom PIO? Would someone be able to give me some rough guidance on the approach to do that please? Just what functions in the function reference to look at would be great. Quote Link to comment
JBenghiat Posted November 5, 2025 Share Posted November 5, 2025 Short answer— yes. Use CreateCustomObject() to insert and SetRField() to set the parameters. I don’t know the particulars of setting up the Panel object, which may also require dealing with objects in the profile group. You may be able to insert a style as a symbol, but I haven’t tested. Quote Link to comment
Vectorworks, Inc Employee klinzey Posted November 6, 2025 Vectorworks, Inc Employee Share Posted November 6, 2025 If you just care about the geometry CreateCustomObject() to insert and SetRField() to set the parameters works just fine. The user will not have access to any of the parameters. Depending on what you are trying to accomplish it may cause issues interacting with other tools. Since the ConnectCAD Panel Layout will be inside of your custom PIO it may not update automatically or interact with other objects int he same way since Vectorworks will no longer see the ConnectCAD Panel Layout on the design layer, it will see your custom PIO on the design layer. Quote Link to comment
spettitt Posted November 6, 2025 Author Share Posted November 6, 2025 Thanks both. Effectively, I'm just trying to have the geometry for that panel layout style appear on the front of the facility panel. No requirement for being able to edit it - just beam the geometry in, so our 2D panel layouts can appear in sections/elevations etc. An instance of each panel layout style (AVB301, AVB302 etc.) will exist on it's own 1:1 design layer as the instance that people edit to change their panel layout design, which updates that style resource. The user can then set the ID parameter of my custom PIO to be 'AVB301', and then inside the PIO I guess I could do CreateCustomObject and then SetPluginStyle(panellayouth, ID), so it searches for a Panel Layout style that matches the ID they specified. I could then just tell people that if they edit a panel layout style, my custom PIO might need a reset in order to display the latest geometry. I might have a 'get latest' button or something that could maybe trigger this. Quote Link to comment
spettitt Posted November 6, 2025 Author Share Posted November 6, 2025 OK, so that went pretty well. The flat panel layout is a Panel Layout PIO instance directly on the layer, using style AVB01. I edit it and add some connectors. I then set the ID of the custom PIO to AVB01, and using the code below, the graphics pop right up. Great. The only downside is that if the custom PIO then resets after the panel layout style was edited, it reverts to showing a default square panel layout: if fp_id: vs.TextSize(72) vs.TextJust(2) vs.TextVerticalAlign(2) vs.MoveTo(0, 0) vs.CreateText(fp_id) text_handle = vs.LNewObj() vs.SetObjectVariableBoolean(text_handle, 1160, False) vs.SetObjectVariableBoolean(text_handle, 1167, True) vs.Move3DObj(text_handle, w/2, h/2, d+f+1) if fp_id and show_layout: # fp_id is the ID field in the OIP # try and render panel layout panel_h = vs.CreateCustomObjectN('PanelLayout', (0,0),0, False) vs.SetPluginStyle(panel_h, fp_id) vs.SetObjectVariableBoolean(panel_h, 1160, False) vs.Move3DObj(panel_h, 0, h, d+f+2) vs.SetObjectVariableBoolean(panel_h, 1167, True) vs.ResetObject(panel_h) # (all of the usual kitchen sink resets...) vs.ResetBBox(panel_h) If I then edit the panel layout style and exit, even without making changes, it pops back up correctly again. How can I make my PIO always return the correct panel layout style? Tagging @Conrad Preen and @Nikolay Zhelyazkov in case this is of interest. Thanks Quote Link to comment
Vectorworks, Inc Employee Nikolay Zhelyazkov Posted November 7, 2025 Vectorworks, Inc Employee Share Posted November 7, 2025 10 hours ago, spettitt said: The only downside is that if the custom PIO then resets after the panel layout style was edited, it reverts to showing a default square panel layout: - Where does the panel come from in the custom PIO? Is it stored in a profile group and then copy&pasted in the child list on reset of the PIO? If so, could it be that you are editing the panel in the child list with the script? Usually on reset all child list objects get deleted and recreated by the recalculate/reset code, so if this is the case you just have to make your script edit the panel in the profile group. If this is not the case, can you also share a sample document with the custom PIO with the panel inside it and the script if it is a custom script in the document? Best Regards, Nikolay Zhelyazkov 1 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.