Jump to content

What are some of the best practices for data in plugins?


Recommended Posts

The context I have at the moment is I have been putting together some fasteners that are currently not represented in the VW package.

While the user will determine "size" and length in the case of most anchors there are a number of characteristics that are portrayed in association with each size.

Washer head thickness and diameter, actual shaft diameter, thread pitch, etc.

Are these measures best stored in a data file, hidden inside the script, in an attached string, or ?

Some of these are the result of calculations which scale based upon size but others are simply this size gets the same amount of threads as the last size or by manufacturer.

Is it good practice to permit user access to these characteristics?  🤔

 

 

Link to comment

The existing VW Fastener tools store all of the base data for different sizes in text files (Applications/VW2022/Plug-Ins/Common/Data.

 

By using a lookup file for the standard data you actually make the tool more flexible as you can update the sizes without having to change the code.

 

But even if you store the data in the script, make the code as generic as possible so that if you need to change a value it is just a number in a lookup table and not hard coded in 15 different places in the script.

Link to comment

Thank Pat,

 

So for anyone wanting a look at what is possible with a little help from our friends here you can take a look at this Concrete Screw Anchor plugin script in VW2022.

I have a feeling that I may be a little weak in protection of attributes. I'm not sure if Push and Pop cover all the bases anymore.

Note there is some extra code where the use of RegularPolygon is concerned due to what I perceive as a couple of bugs. It doesn't produce a closed polygon, adds an extra point at the end overlapping the start point and it divides the input radius by 25.4 when the document is set to imperial.

 

Plugin goes in C:\Users\....\AppData\Roaming\Nemetschek\Vectorworks\2022\Plug-ins

ConcreteScrewAnchor.vso

Data file goes in C:\Users\....\AppData\Roaming\Nemetschek\Vectorworks\2022\Plug-ins\Data

ConcreteAnchor.txt

 

So the caveat to using this is that the data file needs to be flushed out for the pitch and turn columns. I didn't have one of each of their sizes on hand here at the shop. The columns can be identified by the data structure note in the main file. Hilti's north american product offering is the product line I set out incorporate. It has a more simplistic shape than that of the Simpson's product. The latter having a tapered insertion end. I also believe Hilti's product is natively an imported metric product with a number of nominal designations for its imperial sales lineup. Hence why I used the metric system of measuring threads by spacing and not by turns per inch.

 

Have fun.

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...