Placing a dimension on a detail view with iLogic

Placing a dimension on a detail view with iLogic

harvey_craig2RCUH
Advocate Advocate
992 Views
6 Replies
Message 1 of 7

Placing a dimension on a detail view with iLogic

harvey_craig2RCUH
Advocate
Advocate

I can place a dimension on my main drawing with this code:

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")
Dim DetailView = Sheet_1.DrawingViews.ItemByName("A")

'Main view intents.
Dim Edge0 = VIEW1.GetIntent("Edge0")
Dim Face0 = VIEW1.GetIntent("Face0")

'Detail intents.
Dim Edge0_detail = DetailView.GetIntent("Edge0")
Dim Face0_detail = DetailView.GetIntent("Face0")


Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions
ThisDrawing.BeginManage()
If True Then
	Dim GrooveLength = genDims.AddLinear("GrooveLength", VIEW1.SheetPoint(0.9, 1.1), Edge0, Face0)
	'Dim GrooveLength2 = genDims.AddLinear("GrooveLength2", DetailView.SheetPoint(0.9, 1.1), Edge0_detail, Face0_detail)
End If
ThisDrawing.EndManage()

 

harvey_craig2RCUH_0-1724839785287.png

However if I would like to place the same dimension on the detail view with the commented out line of code in the drawing manage section I get this error:

harvey_craig2RCUH_1-1724839917399.png

Where have I gone wrong? I have attached the files.

 

Thanks,

Harvey

0 Likes
993 Views
6 Replies
Replies (6)
Message 2 of 7

Curtis_Waguespack
Consultant
Consultant

@harvey_craig2RCUH ,  My guess was that we had to tell it which point on the line to use in the detail view because it is being clipped, and that seems to be the case. See example below.

 

Note too that we need to tell it to be a horizontal dim in this case.

 

 

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")
Dim DetailView = Sheet_1.DrawingViews.ItemByName("A")

'Main view intents.
Dim Edge0 = VIEW1.GetIntent("Edge0")
Dim Face0 = VIEW1.GetIntent("Face0")

'Detail intents.
Dim Edge0_detail = DetailView.GetIntent("Edge0",PointIntentEnum.kCircularTopPointIntent)
Dim Face0_detail = DetailView.GetIntent("Face0",PointIntentEnum.kCircularTopPointIntent)

Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions
ThisDrawing.BeginManage()

If True Then
	Dim GrooveLength = genDims.AddLinear("GrooveLength", VIEW1.SheetPoint(0.9, 1.1), Edge0, Face0)
	Dim GrooveLength2 = genDims.AddLinear("GrooveLength2", DetailView.SheetPoint(0.9, 1.1), 
		Edge0_detail, Face0_detail, DimensionTypeEnum.kHorizontalDimensionType)
End If
ThisDrawing.EndManage()

 

 

 

@MjDeck , do you have any thoughts on how we can know what the Add<dimension> line needs when we get errors of this type? It's pretty much impossible for the user to determine that the error on line 18 in the AddLinear function, was due to the need to add an optional argument to the GetIntent function on line 11.

 

I can make educated guesses to figure it out, but ultimately it's just trial and error based on past experience... meaning I'm still guessing every time.

 

From a new user's point of view, none of this is discoverable, and learning to work with optional Intent PointEntentEnums and Nearpoints is a huge leap that makes the iLogic dimensioning functions seem really "brittle"

Message 3 of 7

MjDeck
Autodesk
Autodesk

@Curtis_Waguespack , thanks for solving the problem.

 

I don't know exactly why it's necessary to specify a point intent here. As you said, it probably has something to do with the detail view being clipped. The full drawing curve is not available. I'll try to find out more.

I don't agree that it's pure guesswork. If a dimension is not working, the approach is: be more specific about what you want to dimension and how the dimension should be aligned. In some cases, iLogic (and the underlying API) will need more info. You know what you want the dimension to be attached to.
In future, maybe we can improve in these areas:

  • how the API infers intents for dimensions and other annotations
  • the syntax used in iLogic to explicitly specify drawing curves and intents

 

Sometimes you can get useful information by creating dimensions in the UI and then looking at the resulting data in the API. For a linear dimension, look at the IntentOne and IntenTwo properties.


Mike Deck
Software Developer
Autodesk, Inc.

Message 4 of 7

harvey_craig2RCUH
Advocate
Advocate

Hi Mike,

 

Thanks for your response. How do you look at the resulting API data of a UI placed dimension?

 

Thanks,

Harvey

Message 5 of 7

MjDeck
Autodesk
Autodesk

Hi Harvey - this method is pretty well known, but I haven't been able to find an existing description of it. It uses VBA. (It's also possible to do this with iLogic, but you would need Visual Studio as well.)
In VBA, add the following macro:

 

Sub ExaminePick()
Dim picked As Object
Do
    Set picked = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Pick an object")
    If picked Is Nothing Then Exit Sub
Loop
End Sub

 

Set a breakpoint on the "If picked is Nothing" line.
On the View menu, make the Locals Window visible. When you run the macro and hit the breakpoint, the "picked" object will show up in the Locals window and you can drill down into it. Here's a screenshot:
VBADebugPickObject.png




Mike Deck
Software Developer
Autodesk, Inc.

Message 6 of 7

Curtis_Waguespack
Consultant
Consultant

@harvey_craig2RCUH 

 

You can find more information on the VBA object browser that Mike mentioned in the API help getting started info:

https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=GUID-4939ABD1-A15E-473E-9376-D8208EC029EB

 

It's a bit buried at the bottom of the page ( probably needs to be it's own page) 

0 Likes
Message 7 of 7

Curtis_Waguespack
Consultant
Consultant

@MjDeck wrote:


I don't agree that it's pure guesswork...


Thanks @MjDeck, I didn't mean to suggest truly pure guesswork. I was meaning to say that for me I still find myself making guesses, albeit informed guesses, as to why the functions fail in these cases. Does it need a near point? Or does it need an intent enum specified?, if so which one, etc...

 

Your tip to use the VBA object browser is probably what I should be doing here.

 

But for new iLogic users, there is no intuitive path to figuring out that the function needs an "optional" argument to work in these cases. So it becomes nearly impossible for them to move past these errors on their own. And I don't think that's the experience we want new users to have.

 

The fact that we'd need to recommend the VBA tool ( and teach new users to go find this tool, etc. ) is exactly what I mean about this not being discoverable.


I like the ideas you suggest. Really just anything that could be done to give the new user a path to figuring out what the next step to getting the line to work would be great. 

In future, maybe we can improve in these areas:

  • how the API infers intents for dimensions and other annotations
  • the syntax used in iLogic to explicitly specify drawing curves and intents

Thanks again!

0 Likes