circular drawing curves

circular drawing curves

Cadkunde.nl
Collaborator Collaborator
647 Views
3 Replies
Message 1 of 4

circular drawing curves

Cadkunde.nl
Collaborator
Collaborator

Hello,

 

The company I work for want to collect all flatpatterns in an assembly and export them to a drawing, giving it a tag and overall dimensions. I thought of automating this process.

 

My script now works for straight lines,

linesegments.PNG

but having difficulties with arcs.

I can't find the horizontal and vertical most edges as you can select as user when adding a dimension:

 

horizontal edge on curve.png

And this is my attempt to get that point:

Sub main()     
    'variabels for curve dimensioning
            Dim minXPoint As Point2d = Nothing
            Dim CurveMinX As DrawingCurve = Nothing
            Dim oDCurve As DrawingCurve = Nothing
            Dim oDCurves As DrawingCurvesEnumerator = oView.DrawingCurves
            Dim minXCoord As Double = 1000000

            'find curves
            For count = 1 To oDCurves.Count
                oDCurve = oView.DrawingCurves.Item(count)
                Select Case oDCurve.CurveType
                    Case CurveTypeEnum.kCircleCurve
                        Functions.CircularCurveX(oDCurve, bottommostXmin, bottommostXmax, minXCoord, maxXCoord, minXPoint, maxXPoint, CurveMinX, CurveMaxX)
                    Case CurveTypeEnum.kCircularArcCurve
                        Functions.CircularCurveX(oDCurve, bottommostXmin, bottommostXmax, minXCoord, maxXCoord, minXPoint, maxXPoint, CurveMinX, CurveMaxX)
                    Case CurveTypeEnum.kEllipseFullCurve
                        Functions.CircularCurveX(oDCurve, bottommostXmin, bottommostXmax, minXCoord, maxXCoord, minXPoint, maxXPoint, CurveMinX, CurveMaxX)
                    Case CurveTypeEnum.kEllipticalArcCurve
                        Functions.CircularCurveX(oDCurve, bottommostXmin, bottommostXmax, minXCoord, maxXCoord, minXPoint, maxXPoint, CurveMinX, CurveMaxX)
                End Select
            Next

	    'Create overall dimensions
            Dim oIntentminX As GeometryIntent = oSheet.CreateGeometryIntent(CurveMinX, minXPoint)
            Dim oIntentmaxX As GeometryIntent = oSheet.CreateGeometryIntent(CurveMaxX, maxXPoint)
            Dim oDimPointHor As Point2d = oTG.CreatePoint2d(0, 0 - oView.Height / 2 - 1)
            Dim oHorDimension As DrawingDimension = oSheet.DrawingDimensions.GeneralDimensions.AddLinear(oDimPointHor, oIntentminX, oIntentmaxX, DimensionTypeEnum.kHorizontalDimensionType, True)
End sub


    Shared Sub CircularCurveX(ByVal oDCurve As DrawingCurve, ByRef minXCoord As Double, ByRef maxXCoord As Double, ByRef minXPoint As Point2d, ByRef maxXPoint As Point2d, ByRef CurveMinX As DrawingCurve, ByRef CurveMaxX As DrawingCurve)
	'and here is where it goes bad, rangebox doesn't seem to be what I need
        If oDCurve.Evaluator2D.RangeBox.MinPoint.X < minXCoord Then
            minXCoord = oDCurve.Evaluator2D.RangeBox.MinPoint.X
            minXPoint = oDCurve.Evaluator2D.RangeBox.MinPoint
            CurveMinX = oDCurve
        End If

        If oDCurve.Evaluator2D.RangeBox.MaxPoint.X < maxXCoord Then
            maxXCoord = oDCurve.Evaluator2D.RangeBox.MaxPoint.X
            maxXPoint = oDCurve.Evaluator2D.RangeBox.MaxPoint
            CurveMaxX = oDCurve
        End If
    End Sub

 

0 Likes
Accepted solutions (1)
648 Views
3 Replies
Replies (3)
Message 2 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Cadkunde.nl,

 

 Dim oIntentminX As GeometryIntent = oSheet.CreateGeometryIntent(CurveMinX, minXPoint)
            Dim oIntentmaxX As GeometryIntent = oSheet.CreateGeometryIntent(CurveMaxX, maxXPoint)

In oSheet.CreateGeometeryIntent() method, second argument would be one of the following enums.

 

kCircularBottomPointIntent  /kCircularLeftPointIntent  /kCircularRightPointIntent  /kCircularTopPointIntent

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 4

Cadkunde.nl
Collaborator
Collaborator

Thanks that helped, I managed to get all circles and circular curves correctly.

 

I still don't get correct dimensions on ellipses, but I dive into that later

0 Likes
Message 4 of 4

basnederveen
Advocate
Advocate

As far as I know you can only use the coordinates min and max coordinates when dimensioning an ellipse. You can try when manually dimensioning an ellipse that is rotated 10 degrees or something. It will not get the min/max x/y coordinates like with the method you used before for arcs.

 

 

0 Likes