Having a problem creating a LinearGeneralDimension

Having a problem creating a LinearGeneralDimension

dhaverstick
Advocate Advocate
318 Views
1 Reply
Message 1 of 2

Having a problem creating a LinearGeneralDimension

dhaverstick
Advocate
Advocate

I am trying to create a linear general dimension using code that I have used before and I keep getting the error message below.

InventorDimensionError.png

 

I have an assembly, TestSkidAssembly.iam, that has a bunch of workpoints I added that I use to attach dimensions to in a drawing, Test.dwg. All the files I am talking about are attached in a zip file below.

 

In the drawing I add the workpoints to the view, TopView, with the following code:

TopViewObject.SetIncludeStatus(W_ValueBottomDimensionPoint, True)
TopViewObject.SetIncludeStatus(W_ValueTopDimensionPoint, True)

 

These workpoints come across as Centermark objects in the view. I find the centermarks I need to create dimensions to. As you can see in the attached drawing, there is an ordinate dimension set that I created using this methodology using code. However, when I try to create the linear general dimension on the left side of the top view, I get the error above. The dimension you see was created manually by picking the two centermarks. Below is the code I use to try to create the same dimension.

GeometryIntentObj_1 = SheetObject.CreateGeometryIntent(W_ValueBottomCenterMark, IntentTypeEnum.kPoint2dIntent)
GeometryIntentObj_2 = SheetObject.CreateGeometryIntent(W_ValueTopCenterMark, IntentTypeEnum.kPoint2dIntent)
DimTextPoint = InventorApp.TransientGeometry.CreatePoint2d(W_ValueBottomCenterMark.Position.X - 0.5, (W_ValueBottomCenterMark.Position.Y + W_ValueTopCenterMark.Position.Y) / 2)
LinearDimObject = SheetObject.DrawingDimensions.GeneralDimensions.AddLinear(DimTextPoint, GeometryIntentObj_1, GeometryIntentObj_2, DimensionTypeEnum.kVerticalDimensionType, True)

 

Does anyone have any idea as to why I am getting an error? I have used this same code in a different Inventor addin and it worked fine there. What am I missing?

 

Thanks in advance,

 

Darren Haverstick

Paul Mueller Company

 

 

0 Likes
Accepted solutions (1)
319 Views
1 Reply
Reply (1)
Message 2 of 2

dhaverstick
Advocate
Advocate
Accepted solution

So I figured out what was causing the error. I had a few workpoints that I was using in two different views to dimension to. Apparently, Inventor does not like that.

 

Example: I have a workpoint in my assembly named W_ValueBottomDimensionPoint. I used that workpoint to dimension to in two different views.

TopViewObject.SetIncludeStatus(W_ValueBottomDimensionPoint, True)
SideViewObject.SetIncludeStatus(W_ValueBottomDimensionPoint, True)

 

Inventor does create two different centermarks, one in each view, and lets me create the GeometryIntent object to dimension to them. But when I go to create the linear dimension, Inventor throws and error.

 

Solution: What I had to do to get around this was create two workpoints in my assembly at the same location. I used one in the top view and one in the side view.

TopViewObject.SetIncludeStatus(W_ValueBottomDimensionPointTopView, True)
SideViewObject.SetIncludeStatus(W_ValueBottomDimensionPointSideView, True)

 

Inventor has no problem with that and I was able to create the dimensions that I needed to.

 

Darren

0 Likes