Hello together,
I would like to improve the ordinate dimensioning in Inventor. How could I add the dimension in a quicker way?
Process:
1. Pick ordinate dimension
2. choose the view
3. choose the zero point
4. select the line to dimension
5. click next
6. position the dimension
7. click ok
8. repeat from 1 for each dimension.
Add one:
1. Pick ordinate dimension
2. choose the view
3. select the line to dimension
4. click next
5. position the dimension
6. click ok
7. repeat from 1 for each dimension.
Process wish:
1. Pick ordinate dimension
2. choose the view
3. choose the zero point
4. select the line to dimension
6. position the dimension
8. repeat from 1 for each dimension til ESC
Thank you very much
Georg
I found a sample. How could I select the points where the dimensions are placed?
' Create ordinate dimension API Sample 'Description 'This sample demonstrates the creation of ordinate dimensions in a drawing document. 'Before running this sample, select a linear drawing curve on the active drawing document. Public Sub CreateOrdinateDimensions() ' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument = DirectCast(ThisApplication.ActiveDocument, DrawingDocument) ' Set a reference to the active sheet. Dim oActiveSheet As Sheet = DirectCast(oDrawDoc.ActiveSheet, Sheet) ' Set a reference to the drawing curve segment. ' This assumes that a linear drawing curve is selected. Dim oDrawingCurveSegment As DrawingCurveSegment = DirectCast(oDrawDoc.SelectSet(1), DrawingCurveSegment) ' Set a reference to the drawing curve. Dim oDrawingCurve As DrawingCurve = Nothing oDrawingCurve = oDrawingCurveSegment.Parent If Not (oDrawingCurve.CurveType = CurveTypeEnum.kLineSegmentCurve) Then MessageBox.Show("A linear curve should be selected for this sample.") Return End If ' Create point intents to anchor the dimension to. Dim oDimIntent1 As GeometryIntent = Nothing oDimIntent1 = oActiveSheet.CreateGeometryIntent(oDrawingCurve, PointIntentEnum.kStartPointIntent) Dim oDimIntent2 As GeometryIntent = Nothing oDimIntent2 = oActiveSheet.CreateGeometryIntent(oDrawingCurve, PointIntentEnum.kEndPointIntent) ' Set a reference to the view to which the curve belongs. Dim oDrawingView As DrawingView = Nothing oDrawingView = oDrawingCurve.Parent ' If origin indicator has not been already created, create it first. If Not oDrawingView.HasOriginIndicator Then ' The indicator will be located at the start point of the selected curve. oDrawingView.CreateOriginIndicator(oDimIntent1) End If ' Set a reference to the ordinate dimensions collection. Dim oOrdinateDimensions As OrdinateDimensions = Nothing oOrdinateDimensions = oActiveSheet.DrawingDimensions.OrdinateDimensions ' Create the x-axis vector Dim oXAxis As Vector2d = Nothing oXAxis = ThisApplication.TransientGeometry.CreateVector2d(1, 0) Dim oCurveVector As Vector2d = Nothing oCurveVector = oDrawingCurve.StartPoint.VectorTo(oDrawingCurve.EndPoint) Dim oTextOrigin1 As Point2d = Nothing Dim oTextOrigin2 As Point2d = Nothing Dim DimType As DimensionTypeEnum = Nothing If oCurveVector.IsParallelTo(oXAxis) Then ' Selected curve is horizontal DimType = DimensionTypeEnum.kVerticalDimensionType ' Set the text points for the 2 dimensions. oTextOrigin1 = ThisApplication.TransientGeometry.CreatePoint2d(oDrawingCurve.StartPoint.X, oDrawingView.Top + 5) oTextOrigin2 = ThisApplication.TransientGeometry.CreatePoint2d(oDrawingCurve.EndPoint.X, oDrawingView.Top + 5) Else ' Selected curve is vertical or at an angle. DimType = DimensionTypeEnum.kHorizontalDimensionType ' Set the text points for the 2 dimensions. oTextOrigin1 = ThisApplication.TransientGeometry.CreatePoint2d(oDrawingView.Left - 5, oDrawingCurve.StartPoint.Y) oTextOrigin2 = ThisApplication.TransientGeometry.CreatePoint2d(oDrawingView.Left - 5, oDrawingCurve.EndPoint.Y) End If ' Create the first ordinate dimension. Dim oOrdinateDimension1 As OrdinateDimension = Nothing oOrdinateDimension1 = oOrdinateDimensions.Add(oDimIntent1, oTextOrigin1, DimType) ' Create the second ordinate dimension. Dim oOrdinateDimension2 As OrdinateDimension = Nothing oOrdinateDimension2 = oOrdinateDimensions.Add(oDimIntent2, oTextOrigin2, DimType) End Sub
Hi,
You could use a mouse event to get a point from the user. This DevBlog post has an example of using MouseEvents.
http://adndevblog.typepad.com/manufacturing/2013/02/pick-a-point.html
Thanks,
Wayne
Hi Georg,
What is the "problem" exactly? Was the suggestion from Wayne helpful?
You would need to implement a command that prompt the user to select a drawing curve, at the same time, you could use mouse events to check the exact position the user clicked and determine what is the point on the selected curve which is the closest.
See "Sheet.CreateGeometryIntent" in the help files, there are many samples provided along.
Hope that helps,
Philippe.
Hi Philippe,
I could not get it to work to pick the use of the mouse events to check the exact position the user clicked and determine what is the point on the selected curve which is the closest.
Georg