Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ordinate dimension problem

6 REPLIES 6
Reply
Message 1 of 7
GeorgK
605 Views, 6 Replies

ordinate dimension problem

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

6 REPLIES 6
Message 2 of 7
GeorgK
in reply to: GeorgK

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

 

Message 3 of 7
wayne.brill
in reply to: GeorgK

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



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 4 of 7
GeorgK
in reply to: wayne.brill

Hi Wayne,

 

please could you help me with that problem?

 

Thank you Georg

Message 5 of 7
GeorgK
in reply to: GeorgK

Could someone help me with that problem? Thanks Georg

Message 6 of 7
philippe.leefsma
in reply to: GeorgK

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.

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 7 of 7
GeorgK
in reply to: philippe.leefsma

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report