Jump to content
Developer Wiki and Function Reference Links ×

PIO on Automatic layer Plane?


BartHays

Recommended Posts

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 by BartHays
Spelling errors
Link to comment

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.

 

 

image.png.48b43b3ea7cf94d7dfc06f1ed3c97d99.png

 

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

  • Like 1
Link to comment

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)

image.png.388c9b078467b6c6a89ef29ffa7bc26d.png

 

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.

 

image.thumb.png.4cd0bb923bf4879b489d0010ab70b66d.png

 

Bart

 

Link to comment

@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

Link to comment
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)

image.png.388c9b078467b6c6a89ef29ffa7bc26d.png

 

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.

  • Like 2
Link to comment

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.

×
×
  • Create New...