24 | 03 | 2017

Create Alligned Dimension

Alligned Dimensions can be added to a drawing in different ways. The basic steps are show below. To add 3d dimensioning posibilities look at the UCS rotate tutorial.

Sub CreateAlignedDimensions()

 'First we create a rectangle to add the dimensions to.
Dim PLYline As AcadLWPolyline
Dim Points(0 To 9) As Double
'Define the polyline Coordinates XY, XY, XY .....
Points(0) = 0: Points(1) = 0
Points(2) = 0: Points(3) = 100
Points(4) = 200: Points(5) = 100
Points(6) = 200: Points(7) = 0
Points(8) = 0: Points(9) = 0
 
Set PLYline = ThisDrawing.ModelSpace.AddLightWeightPolyline(Points())
 
ZoomAll
 
'Run the dimension code
 
 
  'ThisDrawing.ActiveDimStyle = ThisDrawing.DimStyles.Item("DIMSTYLENAME")
 
    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double
 
    'CREATE THE LENGTH DIMENSION
    ' Define the dimension
    point1(0) = 0: point1(1) = 100: point1(2) = 0
    point2(0) = 200: point2(1) = 100: point2(2) = 0
    location(0) = 100: location(1) = 150: location(2) = 0
 
    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
 
    'REPEAT AND CREATE THE WIDTH DIMENSION
    ' Define the dimension
    point1(0) = 0: point1(1) = 0: point1(2) = 0           'Coordinates for the first line
    point2(0) = 0: point2(1) = 100: point2(2) = 0         'Coordinates for the second line
    location(0) = -50: location(1) = 100: location(2) = 0   'Coordinates for the dimension location
 
    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
 
 
End Sub

And this is the result of the code above:

Dimension Sample

Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2206774
Latest Articles