BartHays Posted January 11, 2023 Share Posted January 11, 2023 (edited) I create my first PIO (RectObject) in an effort to help coordinate graphic panels for exhibitions. It is basically an "X" in a chosen linetype and a text label to display an ID. (It also tracks size, output method, and a mounting method via associated worksheets.) It is working well but needs a couple improvements. The first is in placement. It looks like a PIO can only be inserted on a Layer Plane. Some of our graphics are on "Reading Rails" which are typically sloped. Is there a way to make the PIO align to the Automatic layer Plane? Secondly, is there a way to make the PIO insertion always use the second Mode, Edgeplacement vs Centerline? Many thanks, Bart Edited January 11, 2023 by BartHays Spelling errors Quote Link to comment
Pat Stanford Posted January 12, 2023 Share Posted January 12, 2023 Edit the Plug-in Definition and set to to something other than Required 2D and you should be able to set it to a working plane. For your second question, have you written an Plug-in Object or a Plug-in Tool? If an object and you always want edge placement, just do the calculations internally to put your object where you want it away from the insertion point. HTH 1 Quote Link to comment
BartHays Posted January 13, 2023 Author Share Posted January 13, 2023 Excellent, Thank you Pat, part one solved, For Part two, I have a PlugInObject, Type:Rectangle and the first time I use it it defaults to the first Mode type (see below) But that's a weird way to draw a rectangle. So, I would like to have it jump to Mode 2 by default ( it does stick to that choice for every instance after the first so, not a deal breaker). With this type of PluginObject, it gives me a 'preview' of the rectangle, which is super helpful, I'd like to keep that. Generally speaking the use case is that I have modeled a bunch of geometry and then I go back and add the 2D graphic marker I am creating. So, picking 2 opposite corners works well. (See left object below). My next challenge (should I choose to accept it) it to figure out how to clip my lines to an irregular shape(right object). My first guess is that I recreate my PIO as a tool(?), and have the user select a face, extract the face, then build my lines and text off of the extracted face, deleting the extracted face before completing. I also need to have the script create a Text Style for the IDs, and set the class to use that Text Style by default. That shouldn't be a problem. Bart Quote Link to comment
BartHays Posted January 16, 2023 Author Share Posted January 16, 2023 @Pat Stanford I hope you have another moment to help. I am making good progress but I am struggling with one element, Once I create a new TextStyle (CreateTextStyleRes) How do I set the font and other parameters of the Style? Do I treat it like an object (SetTextFont())? Or do I set the get the current document font, set the document to the font parameters that I want, create the new style and then reset the doc to its previous state? Many thanks Bart Quote Link to comment
Pat Stanford Posted January 16, 2023 Share Posted January 16, 2023 I just answered that last week. See: 1 Quote Link to comment
BartHays Posted January 16, 2023 Author Share Posted January 16, 2023 Perfect, I got it! Thank you!! Bart Quote Link to comment
JBenghiat Posted January 16, 2023 Share Posted January 16, 2023 On 1/12/2023 at 7:13 PM, BartHays said: For Part two, I have a PlugInObject, Type:Rectangle and the first time I use it it defaults to the first Mode type (see below) But that's a weird way to draw a rectangle. So, I would like to have it jump to Mode 2 by default ( it does stick to that choice for every instance after the first so, not a deal breaker). With this type of PluginObject, it gives me a 'preview' of the rectangle, which is super helpful, I'd like to keep that. Generally speaking the use case is that I have modeled a bunch of geometry and then I go back and add the 2D graphic marker I am creating. So, picking 2 opposite corners works well. (See left object below). Agreed -- the rectangular PIO UI is a little wonky. The simple answer is no-you can't eliminate one of the modes in vs/python. You can, however, create a separate custom tool for placing the object. If this is for your own or internal use, just have the tool draw a rectangle, then place and size the PIO accordingly. (Note that for box-type PIO's, regardless of the insertion procedure, the origin is still the left-center). If you want the PIO to always be associated with the tool, see here: https://developer.vectorworks.net/index.php/VS:Similar_Objects_Creation This will cause the tool and PIO to behave as one object. Coding the clipping in vs may be a little challenging. You can set the PIO to have a profile or path group, with you then use to find the intersection. I'm not aware of a way to have VS select the face of an objet, which is what you need to automatically create the shape that goes into the profile group. Again, if this is for internal use, your best route might be to writer a menu command or venture into event-enabled plug-ins to add a button in the PIO that uses the selected object as a clipping mask. You would first have to use the extract surface tool to extract a 2D shape you want to use for clipping. The other strategy would be to add four control points at the corners of the diagonals and use those to set the end points. 2 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.