Jump to content
Developer Wiki and Function Reference Links ×

Learning Vector Work.


Recommended Posts

I think you may need to give us a better description of what you want to do.

 

The simplest way to do what I am reading in your question is to put the text into the Note field. The Vectorscript command to do that is SetDimNote(Handle_to_Dim, 'Note Text);

 

If you really want a more complicated text box to be associated with a dimension then you probably need to create a custom object (PlugIn Object) that consists of the dimension and a separate text box.

 

 

Link to comment

For example. What I am doing now is that . 

1. I Put Dimension into my drawing 

2. After I finish my dimension I highlight every dimension 

3. Once Highlighted it, I got to the object info and click on the Box Text . 

4. Then all dimensions will have box text.

What I am trying to do is that make a custom setting that I can just have the Box text already permanent check.

I am new to scripting so I am still learning . 

thanks . 

 

Link to comment

I don't know of a way to set the Box Text option as the default. The two lines below will set the Box Text option for the first selected object on the active layer. You could wrap this in a repeat loop of use ForEachObject to handle every dimension in the drawing. If you need to box the secondary dimension instead of the primary, switch the 5 to 22 in the SetObjectVariableBoolean line.

 

SetObjectVariableBoolean(FSActLayer,5,True);
ResetObject(FSActLayer);

 

The Reset is required to get the box to actual show. If you are doing a bunch of objects in the script you can probably do a RedrawAll instead and it will only have to update the screen once and might make the script faster for many dimensions.

 

Ask again if you need more help.

Link to comment

your script worked out great , I just thought about some what if instead of making a box since you said you don't know how to make the box text default. 

Is there a way to make like an auto dimension . 

which it will created dimension on anything that has a vertical line or horizontal ?

for example if I have a square , I would click on auto dim and it will create dimension around the square . 

thanks for the help 

Link to comment

You only need to use 22 if you want a box around the "secondary" dimension. VW lets you do dual dimensioning (say metric & imperial at the same time).  5 will box the Primary dimension, 22 will box the secondary dimension.  You have to run two commands to box both.

 

You can try RedrawAll in place of the ResetObject. If you are only doing a single dimension with the script then ResetObject is probably better. If you are looping through a lot of objects RedrawAll is probably better as it will only have to update the screen once instead of after every dimension. In that case you would use it near the end of your script after you have changed all of the dimensions.

 

The SetDimText command will convert any line into a dimension.

 

You can certainly create an auto dimension tool, but my guess is that by the time you get it worked out and all of the special cases and error checking needed to make it work no matter what kind of an object you throw at it, you will spend more time than you would spend dimensioning manually over the next decade. Check the function reference for routines returning the vertices of polygons and remember that rectangles are not polygons and have to be handled as a special case. What would you do when someone passes a curve or a circle instead of a box? What about when text, or a symbol, or some other kind of object. All cases that a general purpose script will have to handle, even if only by explicitly not handling them. Good luck if you choose to proceed.

Link to comment

After putting RedrawAll its giving me an error message. Also another thing Making the dimension in design layer works with the reset object. But where I usually put my dimension is on the annotative viewport . when making build drawings. And the script won't make the dimension box text inside the annotative viewport. 

thanks 

Link to comment

I don't have time to do a full in depth class on how VW works, but you are correct the simple version does not work inside viewport annotations.

 

If you need it to work anywhere, you will need to do more checking on the object to figure out where it is.  The basic way to do this is to GetTypeN(GetParent(Handle_to_Object)); If the type of the parent is a layer then you handle it one way. If the parent is a group or symbol you handle it another way. You have to do more explicit checking to see if it is the annotation group of a viewport.

 

The best suggestion I can offer right now is to search in the Vectorscript and Archive-Resource Share-Vectorscript forums for Viewport Annotations. I know I have posted on this before. Sorry I don't have time to help more right now or next week.

 

I will try to answer specific questions if I can.

Link to comment

Josue,

   The script @Pat Stanford showed you does not work when you are editing inside a Viewport's Annotation Space, nor inside any other container objects, i.e., Symbols, Groups, Profile space of 3D objects, etc. This is because of limitations of the FSActLayer function which only returns handles from selected objects on Design Layers and Sheet Layers.

 

   Do a search on "Waldo" in the Vectorscript Forum. You will get several hits that will show you a few lines that will return a handle to a selected object inside a container, like the Viewport's Annotation Space. Waldo is the nickname given to this kind of code that gets you a handle when you are not on a Design or Sheet Layer. Reference "Where's Waldo" to see where the name came from.

 

Have fun and good luck,

Raymond

 

Link to comment
  • 2 weeks later...

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