Jump to content
Sign in to follow this  
DomC

Dimension Standard

Recommended Posts

Hi

I got a little script, which changes the dimension standard by the name of the dim standard. I did not fount a way to handle the dim-standard directly. I am just able, to get the dimension index and standard name from a dimension object. so my script draws temporary a dimension get the property. I got a Dictionary of DimStdNum and DImStdName at the end. So I could use this script, even the stacking order of the Standards is upside down.

Now the Question:

The very ugly piece of the script is, that i draw and delete objects just to have a relation between DimStdIndexNumber and DimName. Anyone know a direct way to handle to a Dimension Standard?

#Python Code
#At this place some code calculating,
#which standard ist the right one for my design layer and for my Drawing scale.


Choose_Standard='VSSM x0.1'
Dim_Std = {} #Dictionary of  Name and Index Number
i=0;v=''

while v !=1:
try:
	vs.SetDimStd(i)
except:
	pass
vs.LinearDim((0,0), (0,0), 0, 0, 0, 0, 0)
h=vs.LNewObj()
v=vs.GetObjectVariableInt(h,0) #if 1 the function switched to 1 because calling a outindexed standard an error
n=vs.GetObjectVariableString(h,27)
vs.DelObject(h)
i=i-1
if v !=1:
	Dim_Std[n] = v

vs.NameClass(c);
vs.SetDimStd (Dim_Std.get(Choose_Standard));
vs.SetPref(44,False);
vs.SetTool(-210)

Background Info:

(To prevent questions like: "Why you would want to do that"):

Out of the Box, Vectorworks just support one scale for one Design-Layer.

I got a script here to change dim Standard and class to separate different Scales on one Design Layer. It also get the Layer scale of the active layer to choose the right standard for the intended scale in the Viewport. It would work without a much simpler script, if layer scale is set to 1:1. But that somehow hurts me to do that. And the Idea of a Routing-Layer-Scale ist not a bad one. But often there are small informations, which should be scaled in the right relation to the active layer scale.

Annotation are no option (groups, import data, Symbols, PIOs, 3D Objects etc.). Main-Data, Information and Drawing has to be part of the (BIM)- Modell Space.

Share this post


Link to post

If you are just trying to get the index of the active dimension standard, vs.GetPrefInt(71).

There is no way to get the standard name from the index using VS / Python, as dimension standards are neither resources nor name objects. It is possible with the SDK if you are comfortable with that route or if you want to commission a custom project.

If your files all come from the same template, you can build a manual index to name table fairly easily.

Default standards always map to the same names:

1 (Arch)

2 (ASME)

3 (BSI)

4 (DIN)

5 (ISO)

6 (JIS)

7 (SIA)

8 (ASME Dual Side-by-Side)

9 (ASME Dual Stacked)

Custom names map to the list visible in the Custom Standards dialog, with 0 being the top item, -1 the second, -2 the third, etc.

HTH,

Josh

Share this post


Link to post

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.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...