Entity not recognised as drawing curve in detail view

Entity not recognised as drawing curve in detail view

harvey_craig2RCUH
Advocate Advocate
1,002 Views
6 Replies
Message 1 of 7

Entity not recognised as drawing curve in detail view

harvey_craig2RCUH
Advocate
Advocate

I have labelled the fillet face in the model and I have created that loops through all the DrawingCurves and identifies entity names matching matching a name I give it. This works great in a regular view but when I do the same for a detail view it doesn't work. I have a line that counts the number of entities it match to my face name I give it and it returns 0 when attempting the detail view (returns 2 for the working main view), therefore the rule does not recognise the entity in the drawing curve when in a detail view. How do I get it to recognise the entities when they're in the detail view?

 

My rule (use line 3 to switch the view):

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)'1 for main view, 2 for detail view.
Dim oModelDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oNamedEntities = iLogicVb.Automation.GetNamedEntities(oModelDoc)
Dim oFace1 As Face = oNamedEntities.FindEntity("FilletFace")
Dim oFilletFace1List As New ArrayList
Dim oGeomIntentList As New ArrayList
For Each oDrawingCurve As DrawingCurve In oView.DrawingCurves
    If oDrawingCurve.ModelGeometry Is oFace1 Then
		oFilletFace1List.Add(oDrawingCurve)
		oGeomIntentList.Add(oSheet.CreateGeometryIntent(oDrawingCurve))
    End If
Next
MsgBox(oFilletFace1List.Count) 'Using this to identify if my loop is recognising face entity in the curve. 

Dim FilletIdentifier As Integer = 1 'Chose whick fillet to apply dimension to. 0 bottom, 1 top.
Dim oGeomIntent As GeometryIntent = oGeomIntentList(FilletIdentifier)
Dim PositionPt As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oFilletFace1List(FilletIdentifier).MidPoint.X + 0.5, oFilletFace1List(FilletIdentifier).MidPoint.Y + 0.5)

Dim oGenDims As GeneralDimensions = oSheet.DrawingDimensions.GeneralDimensions
oGenDims.AddRadius(PositionPt, oGeomIntent)

 

Main on left, detail on right (files attached):

harvey_craig2RCUH_0-1725266925905.png

 

Thanks,

Harvey

0 Likes
Accepted solutions (2)
1,003 Views
6 Replies
Replies (6)
Message 2 of 7

Michael.Navara
Advisor
Advisor
Accepted solution

You can't use this approach, because it depends on Inventor's implementation of detail views. The best result you can achieve using DrawingView.DrawingCurves property.

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)'1 for main view, 2 for detail view.
Dim oModelDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oNamedEntities = iLogicVb.Automation.GetNamedEntities(oModelDoc)

Dim oFace1 As Face = oNamedEntities.FindEntity("FilletFace")

Dim oDetailView As DrawingView = oSheet.DrawingViews.Item(2)'1 for main view, 2 for detail view.
Dim filletCurves = oDetailView.DrawingCurves(oFace1)
Logger.Debug(filletCurves.Count)

 

 

 

Under the hood

This is just my experience and investigation based on behavior of Inventor. Not confirmed by developers.

Drawing views in Inventor is computed as special view on 3D model. When you create detail view, new surface body is created based on your input. This surface body is rendered to drawing view. That's why the drawing curves in detail view belongs to different faces and edges not to the original faces and edges. Relationships between them are provided by AssociativeId. The situation is similar to cut operations in assembly. But sometimes this relationships doesn't work correctly. 

0 Likes
Message 3 of 7

harvey_craig2RCUH
Advocate
Advocate

Thank you Michael. This worked great despite me not attaching the document's I said I would!

0 Likes
Message 4 of 7

Michael.Navara
Advisor
Advisor

No problem. It looks like the same model from your previous post. 😉

0 Likes
Message 5 of 7

harvey_craig2RCUH
Advocate
Advocate

Hi Michael,

 

One additional requirement for this. If it is part of an assembly, it gives me this error:

harvey_craig2RCUH_0-1725361057186.png

Which isn't very helpful. This is my rule, and this time I've attached the files!

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)'1 for main view, 2 for detail view.
Dim oViewName As String = oView.Name

Dim oModelDoc = ActiveSheet.View(oViewName).ModelDocument
Dim oAssemblyDoc As AssemblyDocument = oModelDoc
Dim oPartDoc As PartDocument = oAssemblyDoc.ComponentDefinition.Occurrences.ItemByName("Fillet Part").Definition.Document
Dim oNamedEntities = iLogicVb.Automation.GetNamedEntities(oPartDoc)

Dim oFace1 As Face = oNamedEntities.FindEntity("FilletFace")

Dim oDetailView As DrawingView = oSheet.DrawingViews.Item(2)'1 for main view, 2 for detail view.
Dim filletCurves = oDetailView.DrawingCurves(oFace1)

oGeomIntent=oSheet.CreateGeometryIntent(filletCurves.Item(1))
Logger.Debug(filletCurves.Count)

Dim PositionPt As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(filletCurves.Item(1).MidPoint.X, filletCurves.Item(1).MidPoint.y)

Dim oGenDims As GeneralDimensions = oSheet.DrawingDimensions.GeneralDimensions
For Each item In oGenDims
	item.delete
Next
oGenDims.AddRadius(PositionPt, oGeomIntent)

harvey_craig2RCUH_1-1725361142565.jpeg

Thanks,

Harvey

 

0 Likes
Message 6 of 7

Michael.Navara
Advisor
Advisor
Accepted solution

You need to use face proxy instead of face (line 16-19) and correct occurrence name (line 8).

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)'1 for main view, 2 for detail view.
Dim oViewName As String = oView.Name

Dim oModelDoc = ActiveSheet.View(oViewName).ModelDocument
Dim oAssemblyDoc As AssemblyDocument = oModelDoc
Dim oPartOcc = oAssemblyDoc.ComponentDefinition.Occurrences.ItemByName("Fillet Part:1") 'incorrect occurrence name
Dim oPartDoc As PartDocument = oPartOcc.Definition.Document
Dim oNamedEntities = iLogicVb.Automation.GetNamedEntities(oPartDoc)

Dim oFace1 As Face = oNamedEntities.FindEntity("FilletFace")

Dim oDetailView As DrawingView = oSheet.DrawingViews.Item(2)'1 for main view, 2 for detail view.

'In Assembly context you need to use FaceProxy instead of Face
Dim oFace1Proxy As FaceProxy
oPartOcc.CreateGeometryProxy(oFace1, oFace1Proxy)
Dim filletCurves = oDetailView.DrawingCurves(oFace1Proxy)

oGeomIntent=oSheet.CreateGeometryIntent(filletCurves.Item(1))
Logger.Debug(filletCurves.Count)

Dim PositionPt As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(filletCurves.Item(1).MidPoint.X, filletCurves.Item(1).MidPoint.y)

Dim oGenDims As GeneralDimensions = oSheet.DrawingDimensions.GeneralDimensions
For Each item In oGenDims
	item.delete
Next
oGenDims.AddRadius(PositionPt, oGeomIntent)

 

Message 7 of 7

harvey_craig2RCUH
Advocate
Advocate

Thanks Michael, works great.

0 Likes