To automate the dimension of an view using curves.

To automate the dimension of an view using curves.

Anonymous
Not applicable
747 Views
5 Replies
Message 1 of 6

To automate the dimension of an view using curves.

Anonymous
Not applicable

I want to create dimensioning of an view by using curves, I have already created views but the issue is I cannot use attributes so I need to iterate through the curves of an view and generate the dimension.

I was things of using CurveType to get me different methods for getting the dimension of that curve while iterating through the curves,

0 Likes
Accepted solutions (1)
748 Views
5 Replies
Replies (5)
Message 2 of 6

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

You can create general dimension as shown below. But be aware, the creation is the most less problem of all. There are a lot of open questions. It's quite simple for a user to decide if a dimension is needed, where to place and many more, but not for a program. Even such a primitive thing like which side to offset dimension and how far away and to avoid colliding an existing dimension.

It could be more work to sort the automatic inserted dimensions and delete unused, doubled and so on, than let user insert himself.

Option Explicit

Private Sub CreateDimension()

Dim oApp As Inventor.Application
Set oApp = ThisApplication

Dim oDrawDoc As DrawingDocument
Set oDrawDoc = oApp.ActiveDocument

Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet

Dim oView As DrawingView
Set oView = oSheet.DrawingViews.Item(1)

Dim oDimension As GeneralDimension
Dim oIntent As GeometryIntent
Dim oPoint As Point2d

Dim oTrans As Transaction
Set oTrans = oApp.TransactionManager.StartTransaction(oDrawDoc, "CreateDimensions")

Dim oDrawCurve As DrawingCurve
For Each oDrawCurve In oView.DrawingCurves
    Select Case oDrawCurve.CurveType
    Case kLineCurve:
        Set oIntent = oSheet.CreateGeometryIntent(oDrawCurve)
        Set oPoint = oApp.TransientGeometry.CreatePoint2d(oDrawCurve.MidPoint.x + 1, oDrawCurve.MidPoint.y + 1)
        Set oDimension = oSheet.DrawingDimensions.GeneralDimensions.AddLinear(oPoint, oIntent, , kAlignedDimensionType, True)
    Case kLineSegmentCurve:
        Set oIntent = oSheet.CreateGeometryIntent(oDrawCurve)
        Set oPoint = oApp.TransientGeometry.CreatePoint2d(oDrawCurve.MidPoint.x + 1, oDrawCurve.MidPoint.y + 1)
        Set oDimension = oSheet.DrawingDimensions.GeneralDimensions.AddLinear(oPoint, oIntent, , kAlignedDimensionType, True)
    Case kCircleCurve:
        Set oIntent = oSheet.CreateGeometryIntent(oDrawCurve)
        Set oPoint = oApp.TransientGeometry.CreatePoint2d(oDrawCurve.centerPoint.x + 2, oDrawCurve.centerPoint.y + 2)
        Set oDimension = oSheet.DrawingDimensions.GeneralDimensions.AddDiameter(oPoint, oIntent, , False, True)
    Case kCircularArcCurve:
        Set oIntent = oSheet.CreateGeometryIntent(oDrawCurve)
        Set oPoint = oApp.TransientGeometry.CreatePoint2d(oDrawCurve.centerPoint.x + 2, oDrawCurve.centerPoint.y + 2)
        Set oDimension = oSheet.DrawingDimensions.GeneralDimensions.AddDiameter(oPoint, oIntent, , False, True)
    End Select
Next

oTrans.End

End Sub

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 3 of 6

Anonymous
Not applicable

thank you, will try doing it with your approach, can will also direct me to some useful documentation related to curve dimensioning because i am hardly able to find anything related to curve dimensioning. 

0 Likes
Message 4 of 6

Ralf_Krieg
Advisor
Advisor

Hello

 

In the API help are some examples for creating different types of dimensions.

https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-DE98632B-3DC0-422B-A1C6-8A5A15C99E11


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 5 of 6

Anonymous
Not applicable

thanks, but what I needed was something outside of the inventor API help, with much details, anyway if you know anything outside of API help then it would be great help for me, thanks in advance.

I have already accepted the previous answer as solution, so thanks again.

0 Likes
Message 6 of 6

Anonymous
Not applicable

Also I was currently working on removing the overlapping of dimension using bounding box of the dimension, so if you have worked on it then it would be great help to me, thanks in advance.

0 Likes