Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveDimStyle 1

Status
Not open for further replies.

RufussMcGee

Technical User
Jan 7, 2005
117
US
How or where do you use this in VisualBasic tried writing a code few different ways but cannot find an example to go by.

Thanks
 
Hi Rufuss,

I usually use it for checking purposes, meaning I want a particular dimstyle current before I create dimensions i.e.:

Code:
If Not ThisDrawing.ActiveDimStyle.Name = "MyStyle" Then
  ThisDrawing.ActiveDimStyle = ThisDrawing.DimStyles("MyStyle")
End If

Todd
 
How do you make the dimension horizontal to your drawing? Figured need to write this part of a code

Dim DimenH as AcadDimRotated
Dim point1(2) as double
Dim point2(2) as double
Dim location(2) as double
Dim angle as double

point1(0) = 0: point1(1) = 0: point1(2) = 0:
point2(0) = 9: point2(1) = 1: point2(2) = 0:
location(0) = 4.5: location(1) = 7: location(2) = 0:

Set DimenH = ThisDrawing.ModelSpace.AddDimRotated (point1, point2, location, angle)

*Not sure how to figure the angle to make the dimension horizontal.

Any help is great help.

Thanks.

 
Ignore the above figured out the angle just need to be in radians whereas horizonal is 'pi' 3.1415927. That always have questions like how to make a different layer active? We put Dimension on layer DIM and draw on layer P.

Any help is welcome.

Thanks.
 
Hi Rufuss,

Code:
ThisDrawing.ActiveLayer = ThisDrawing.Layers("DIM")

HTH
Todd
 
What is the best way to change the AutoCad Variables?

For example would like to override the dimsd1 and dimjust, to name get a few, just before I have the program do some of the dimensioning.
 
Hi Rufuss,

Code:
' Collect current value to reset.
'
oldDIMSD1Var = ThisDrawing.GetVariable("DIMSD1")
oldDIMJUSTVar = ThisDrawing.GetVariable("DIMJUST")
  
' Set to the desired values.
'
ThisDrawing.SetVariable "DIMSD1", NewDIMSD1Var
ThisDrawing.SetVariable "DIMJUST", NewDIMJUSTVar
  
....

HTH
Todd
 
How do I get the variable to override the dimension defaults? This is part of the code that I have so for,


Case 1
ThisDrawing.SetVariable "DIMJUST", 2
Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(Point4, Point3, Location1)
Set DimenH = ThisDrawing.ModelSpace.AddDimRotated(Point4, DPt1, Location, 3.1415927)


Thanks May the CODE be with you.
 
Hi Rufuss,

Your chunk of code should be doing just that, setting an override to the current dimension style. I take this isn't happening?

Todd
 
Correct it just does the standard dimension where as the text is centered and extensions are on. But when I add a new dimension from the toolbar dimjust and others are enabled. When dimensioning is placed through the code it does not show up correctly.

Thanks.
 
Hi Rufuss,

This one had me stumped but here's what you'll need to do:

From the VBA help:
When you change a dimensioning system variable, you are actually setting a document override for the active dimension style; you are not changing the active dimension style itself. This means that all newly created dimensions will still be created with the active dimension style only and will not reflect the overrides from the system variables. The overrides from the system variables will not be recognized on new dimensions until the active dimension style is updated. To change the settings of any dimension style, use the CopyFrom method. This method copies a dimension style configuration, including overrides, from a document, dimension, or other dimension style.

HTH
Todd
 
Little glad had you stumped makes up for all the little silly questions that I ask you have to just laugh at. Starting to get the results that I have been looking for have wrote this code so for....

dimObj.DimLine1Suppress = "1" (setvar DIMSD1)
dimObj.ExtLine1Suppress = "1" (setvar DIMSE1)
dimObj.UnitsFormat = "5"
dimObj.Arrowhead2Type = "6"
dimObj.ArrowheadSize = "0.125"

But what would control DIMJUST? Would like the values to equal 2.

Really appreciate ALL your help.
Thanks.
 
Find the solution in case anyone else is looking for the answer.

dimObj.HorizontalTextPosition = acSecondExtensionLine

This is the answer to the Autocad varible DimJust = 2.

Thanks to TCAPENTER I have learned lot in programming VisualBasic for Auotcad.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top