<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Client Graphics on drawing, position based on part location within view in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/client-graphics-on-drawing-position-based-on-part-location/m-p/12015577#M153561</link>
    <description>&lt;P&gt;Hi, I am trying to highlight components on a drawing view as solid red using client graphics. I am using the componentoccurrence of the assembly in the drawing view to create surfacegraphics and display that. It is working where it will display what i was expecting but I am stuck trying to position it, it defaults to the center of the view. I can move it with SetTransformBehavior but I can't get an accurate position based on the part itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is how do we get the part origin point in drawing/drawing view space using a componentoccurrence&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This loops through each view&lt;/P&gt;&lt;LI-CODE lang="general"&gt;For Each oDrawingView In sparesSheet.DrawingViews
		Try
			oDataSets = oDrawingView.GraphicsDataSetsCollection.Item("CG_Test3")
			oDataSets.Delete
			oDataSets = oDrawingView.GraphicsDataSetsCollection.Add("CG_Test3")
		Catch
			oDataSets = oDrawingView.GraphicsDataSetsCollection.Add("CG_Test3")
		End Try
		
		Try
			oClientGraphics = oDrawingView.ClientGraphicsCollection.Item("CG_Test3")
			oClientGraphics.Delete
			oClientGraphics = oDrawingView.ClientGraphicsCollection.Add("CG_Test3")
		Catch
			oClientGraphics = oDrawingView.ClientGraphicsCollection.Add("CG_Test3")
		End Try
		
		Dim oModelDoc As Document
		oModelDoc = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument
		
		TraverseAssembly(oModelDoc.ComponentDefinition.Occurrences)
		
		iLogicVb.UpdateWhenDone = True	
	Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the part actually creating client graphics within the traverseassembly loop&lt;/P&gt;&lt;LI-CODE lang="general"&gt;			Dim oLineNode As GraphicsNode
			oLineNode = oClientGraphics.AddNode(1)
			       
			Dim oTransientBRep As TransientBRep
			oTransientBRep = ThisApplication.TransientBRep
			       
			 'By Transient Brep Class To copy the surface body
			  Dim oBody As SurfaceBody
			  oBody = oTransientBRep.Copy(oOcc.Definition.SurfaceBodies.Item(1))
			    
			  ' Create client graphics based on the transient body
			  Dim oSurfaceGraphics As SurfaceGraphics
			  oSurfaceGraphics = oLineNode.AddSurfaceGraphics(oBody)
				
				oSurfaceGraphics.Color = oColor
				
				oSurfaceGraphics.BurnThrough = True
				
				'oSurfaceGraphics.SetViewSpaceAnchor(oTG.CreatePoint(0,0,0), oTG.CreatePoint2d(10,10), ViewLayoutEnum.kBottomLeftViewCorner)
				Dim temp As WorkPoint
				temp = oOcc.Definition.WorkPoints(1)
				
				Dim tempproxy As WorkPointProxy
				oOcc.CreateGeometryProxy(temp, tempproxy)
				
				oSurfaceGraphics.SetTransformBehavior(oTg.CreatePoint(tempproxy.Point.X, tempproxy.Point.Y, tempproxy.Point.Z), DisplayTransformBehaviorEnum.kFrontFacing)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jun 2023 20:16:46 GMT</pubDate>
    <dc:creator>jdasilvaS39UQ</dc:creator>
    <dc:date>2023-06-06T20:16:46Z</dc:date>
    <item>
      <title>Client Graphics on drawing, position based on part location within view</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/client-graphics-on-drawing-position-based-on-part-location/m-p/12015577#M153561</link>
      <description>&lt;P&gt;Hi, I am trying to highlight components on a drawing view as solid red using client graphics. I am using the componentoccurrence of the assembly in the drawing view to create surfacegraphics and display that. It is working where it will display what i was expecting but I am stuck trying to position it, it defaults to the center of the view. I can move it with SetTransformBehavior but I can't get an accurate position based on the part itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is how do we get the part origin point in drawing/drawing view space using a componentoccurrence&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This loops through each view&lt;/P&gt;&lt;LI-CODE lang="general"&gt;For Each oDrawingView In sparesSheet.DrawingViews
		Try
			oDataSets = oDrawingView.GraphicsDataSetsCollection.Item("CG_Test3")
			oDataSets.Delete
			oDataSets = oDrawingView.GraphicsDataSetsCollection.Add("CG_Test3")
		Catch
			oDataSets = oDrawingView.GraphicsDataSetsCollection.Add("CG_Test3")
		End Try
		
		Try
			oClientGraphics = oDrawingView.ClientGraphicsCollection.Item("CG_Test3")
			oClientGraphics.Delete
			oClientGraphics = oDrawingView.ClientGraphicsCollection.Add("CG_Test3")
		Catch
			oClientGraphics = oDrawingView.ClientGraphicsCollection.Add("CG_Test3")
		End Try
		
		Dim oModelDoc As Document
		oModelDoc = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument
		
		TraverseAssembly(oModelDoc.ComponentDefinition.Occurrences)
		
		iLogicVb.UpdateWhenDone = True	
	Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the part actually creating client graphics within the traverseassembly loop&lt;/P&gt;&lt;LI-CODE lang="general"&gt;			Dim oLineNode As GraphicsNode
			oLineNode = oClientGraphics.AddNode(1)
			       
			Dim oTransientBRep As TransientBRep
			oTransientBRep = ThisApplication.TransientBRep
			       
			 'By Transient Brep Class To copy the surface body
			  Dim oBody As SurfaceBody
			  oBody = oTransientBRep.Copy(oOcc.Definition.SurfaceBodies.Item(1))
			    
			  ' Create client graphics based on the transient body
			  Dim oSurfaceGraphics As SurfaceGraphics
			  oSurfaceGraphics = oLineNode.AddSurfaceGraphics(oBody)
				
				oSurfaceGraphics.Color = oColor
				
				oSurfaceGraphics.BurnThrough = True
				
				'oSurfaceGraphics.SetViewSpaceAnchor(oTG.CreatePoint(0,0,0), oTG.CreatePoint2d(10,10), ViewLayoutEnum.kBottomLeftViewCorner)
				Dim temp As WorkPoint
				temp = oOcc.Definition.WorkPoints(1)
				
				Dim tempproxy As WorkPointProxy
				oOcc.CreateGeometryProxy(temp, tempproxy)
				
				oSurfaceGraphics.SetTransformBehavior(oTg.CreatePoint(tempproxy.Point.X, tempproxy.Point.Y, tempproxy.Point.Z), DisplayTransformBehaviorEnum.kFrontFacing)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 20:16:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/client-graphics-on-drawing-position-based-on-part-location/m-p/12015577#M153561</guid>
      <dc:creator>jdasilvaS39UQ</dc:creator>
      <dc:date>2023-06-06T20:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Client Graphics on drawing, position based on part location within view</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/client-graphics-on-drawing-position-based-on-part-location/m-p/12017393#M153603</link>
      <description>&lt;P&gt;I was able to figure it out. I got the transformation of the occurrence in the assembly and combined it with the transform of the assembly within the view and set the graphics node transform to that and it worked perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oLineNode As GraphicsNode
			oLineNode = oClientGraphics.AddNode(1)
			
			Dim oOccPtInAssem As Matrix
			oOccPtInAssem = oOcc.Transformation
			Dim oAssemPtInView As Matrix
			oAssemPtInView = oDrawingView.ModelToDrawingViewTransform
			
			oOccPtInAssem.PreMultiplyBy(oAssemPtInView)

			oLineNode.Transformation = oOccPtInAssem&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Jun 2023 13:35:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/client-graphics-on-drawing-position-based-on-part-location/m-p/12017393#M153603</guid>
      <dc:creator>jdasilvaS39UQ</dc:creator>
      <dc:date>2023-06-07T13:35:55Z</dc:date>
    </item>
  </channel>
</rss>

