Reply
Solved! Go to solution

Coordinate Dimension

Hi there,

I'm trying to dimension a block and almost do, but only have a little problem

the code not putme the dim only ".000" in all dim's and i dont know how change the vertical to horizontal way someone already do this....  know dim in ordenate way....  

I want this

I really apresiate this Thank's.....

 

3 REPLIES

Re: Coordinate Dimension

This is my code .net if someone are interested....

 

Dim objApplication As SolidEdgeFramework.Application = Nothing
        Dim objdraft As SolidEdgeDraft.DraftDocument = Nothing
        Dim objDocuments As SolidEdgeFramework.Documents = Nothing
        Dim objdvcircle2d As SolidEdgeDraft.DVCircle2d = Nothing
        Dim objdvcircles2d As SolidEdgeDraft.DVCircles2d = Nothing
        Dim objsheet As SolidEdgeDraft.Sheet = Nothing
        Dim objDrawingViews As SolidEdgeDraft.DrawingViews = Nothing
        Dim objDrawingView As SolidEdgeDraft.DrawingView = Nothing
        Dim objlines As SolidEdgeDraft.DVLines2d = Nothing
        Dim objline As SolidEdgeDraft.DVLine2d = Nothing
        'Dim objcircls As SolidEdgeDraft.DVCircles2d = Nothing
        'Dim objcircl As SolidEdgeDraft.DVCircle2d = Nothing
        Dim objcentermarks As SolidEdgeFrameworkSupport.CenterMarks = Nothing
        Dim objcentermark As SolidEdgeFrameworkSupport.CenterMark = Nothing
        Dim objdims As SolidEdgeFrameworkSupport.Dimensions = Nothing
        Dim objdimension As SolidEdgeFrameworkSupport.Dimension = Nothing
        'Dim bAnglClocWis As Boolean
        Dim objAttribSets As Object
        Dim v As Integer = 1, l As Integer = 1
        Dim xx As Double = 0.0, yy As Double = 0.0, x1 As Double = 0.0, x2 As Double = 0.0, y1 As Double = 0.0, y2 As Double = 0.0
        Dim lgt As Double = 0.0, ang As Double = 0.0
        Dim nnam As String
        Try
            objApplication = Marshal.GetActiveObject("SolidEdge.Application")
            objdraft = objApplication.ActiveDocument
            objsheet = objdraft.ActiveSheet
            'objcentermarks = objdraf.ActiveSheet.CenterMarks
            objDrawingViews = objsheet.DrawingViews
            objcentermarks = objsheet.CenterMarks
            objdims = objsheet.Dimensions
            v = objDrawingViews.Count
            Do While v > 0
                objDrawingView = objDrawingViews.Item(v)
                objDrawingView.GetOrigin(xx, yy)
                xx = Left(xx, 16)
                yy = Left(yy, 16)
                objcentermark = objcentermarks.Add(xx, yy, 0.0)
                objdimension = objdims.AddCoordinateOrigin(Object:=objcentermark, x:=0.0, y:=0.0, z:=0.0, keyPoint:=False)
                objdimension.TrackDistance = 0.02
                objlines = objDrawingView.DVLines2d
                l = objlines.Count
                Do While l > 0
                    objline = objlines.Item(l)
                    nnam = objline.Name
                    ang = objline.Angle
                    lgt = objline.Length * 39.370078740157481
                    objline.GetStartPoint(x1, y1)
                    x1 = Left(x1, 16)
                    y1 = Left(y1, 16)
                    objline.GetEndPoint(x2, y2)
                    x2 = Left(x2, 16)
                    y2 = Left(y2, 16)
                    x1 = x1 + xx
                    x2 = x2 + xx
                    y1 = y1 + yy
                    y2 = y2 + yy
                    If x1 < x2 And y1 = y2 Then
                        objcentermark = objcentermarks.Add(x1, y1, 0.0)
                    End If
                    If x2 < x1 And y1 = y2 Then
                        objcentermark = objcentermarks.Add(x2, y2, 0.0)
                    End If
                    'objcentermark = objcentermarks.Add(x1, y1, 0.0)
                    'objcentermark = objcentermarks.Add(x2, y2, 0.0)
                    objdimension = objdims.AddCoordinate(Obj1:=objcentermark, x1:=0.0, y1:=0.0, z1:=0.0, keyPoint1:=True, _
                               Obj2:=objcentermark, x2:=0.5, y2:=0.5, z2:=0.0, keyPoint2:=True)
                    objApplication = objdimension.Application
                    'bAnglClocWis = objdimension.AngleClockwise
                    'objdimension.AngleClockwise = True
                    objAttribSets = objdimension.AttributeSets

                    l = l - 1
                Loop
                v = v - 1
            Loop

 Thank's

Solution
Solution
Accepted by topic author Damon
‎08-26-2015 04:32 AM

Re: Coordinate Dimension

Here is something that works for me (Sorry it's in french), see the attachment.

 

When adding the coordinate dimension you should refer to th origine of cotation as obj1.


Romuald BERTIN

Re: Coordinate Dimension

Thank's rbertin

I used your code and it's working only change some objects, thank's lot......