<?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 Re: Client Graphics - Circle Fill Colour in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3857399#M131413</link>
    <description>&lt;P&gt;Hi Matt,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Following worked for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim col As Color&lt;BR /&gt; Set col = ThisApplication.TransientObjects.CreateColor(255, 35, 35)&lt;BR /&gt; oCircleGraphics.Color = col&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See attached image.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ishwar N&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/50545i35213B3E4963E530/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="color.png" title="color.png" align="center" /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2013 06:05:57 GMT</pubDate>
    <dc:creator>nagwani</dc:creator>
    <dc:date>2013-04-12T06:05:57Z</dc:date>
    <item>
      <title>Client Graphics - Circle Fill Colour</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3857385#M131412</link>
      <description>&lt;P&gt;I am trying to fill a client graphics circle with colour but am having no luck, can anyone help me. I'm just using the sample included in the API Samples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;' Create a transient circle object
Dim oCircle As Inventor.Circle
Set oCircle = oTransGeom.CreateCircle(oCenter, oNormal, 1)
        
' Create a circle graphics object within the node.
Dim oCircleGraphics As CurveGraphics
Set oCircleGraphics = oCurvesNode.AddCurveGraphics(oCircle)
        
Call oCircleGraphics.Color.SetColor(255,35,35) ' This line doens't work&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Any help would be great,&lt;/P&gt;&lt;P&gt;cheers. Matt&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 05:07:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3857385#M131412</guid>
      <dc:creator>matt_jlt</dc:creator>
      <dc:date>2013-04-12T05:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Client Graphics - Circle Fill Colour</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3857399#M131413</link>
      <description>&lt;P&gt;Hi Matt,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Following worked for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim col As Color&lt;BR /&gt; Set col = ThisApplication.TransientObjects.CreateColor(255, 35, 35)&lt;BR /&gt; oCircleGraphics.Color = col&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See attached image.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ishwar N&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/50545i35213B3E4963E530/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="color.png" title="color.png" align="center" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 06:05:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3857399#M131413</guid>
      <dc:creator>nagwani</dc:creator>
      <dc:date>2013-04-12T06:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Client Graphics - Circle Fill Colour</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3857502#M131414</link>
      <description>&lt;P&gt;Thanks, but I'm actually trying to fill the circle with a colour (see image attached) , it seems like i'm doing the wrong thing as you've shown me the colour option only changes the line colour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas or can it not be done for circles?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, Matt.&lt;/P&gt;&lt;P&gt;&lt;IMG align="middle" alt="Screenshot.jpg" border="0" title="Screenshot.jpg" src="https://forums.autodesk.com/t5/image/serverpage/image-id/50554i41B35DD8E8549B1E/image-size/original?v=mpbl-1&amp;amp;px=-1" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 08:14:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3857502#M131414</guid>
      <dc:creator>matt_jlt</dc:creator>
      <dc:date>2013-04-12T08:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Client Graphics - Circle Fill Colour</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3863361#M131415</link>
      <description>&lt;P&gt;Client graphics are at a very low level in the system.&amp;nbsp; At the lowest level all they understand is lines, triangles, and textures.&amp;nbsp; At this level, to create what looks like a filled circles you'll need to create a set of triangles that fills the area of the circle and approximates the outer smooth shape.&amp;nbsp; That's what Inventor is doing internally.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Client graphics does support one level of abstraction that makes it a little bit easier than working with triangles and lines call CurveGraphics.&amp;nbsp; The sample code shown previously that draws a circle demonstrates this.&amp;nbsp; In this case the circle geometry is being provided to client graphics and then it's internally converting it to a series of lines for the display.&amp;nbsp; It approximates it with enough lines based on the current size of the circle on the screen so that it always appears smooth.&amp;nbsp; There currently isn't the concept of filling curves in client graphics.&amp;nbsp; However, you can effectively do the same thing by providing a surface instead.&amp;nbsp; This is called SurfaceGraphics and you can provide a solid or surfaces and it will create the appropriate triangles for the display.&amp;nbsp; In this case we want a surface that is a plane&amp;nbsp;trimmed&amp;nbsp;by a circle.&amp;nbsp; The API supports to the ability to create transient surfaces, but I'll be honest and tell you it is one of the more advanced areas of the API.&amp;nbsp; Here's some sample code that demonstrates creating what looks like a filled circle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Public Sub FilledCircle()
    Dim partDoc As PartDocument
    Set partDoc = ThisApplication.ActiveDocument
    
    Dim cg As ClientGraphics
    On Error Resume Next
    Set cg = partDoc.ComponentDefinition.ClientGraphicsCollection.Item("Fill Test")
    If Err.Number = 0 Then
        ' Client graphics already exist, so delete them.
        cg.Delete
        ThisApplication.ActiveView.Update
        Exit Sub
    End If
    
    Dim tg As TransientGeometry
    Set tg = ThisApplication.TransientGeometry
    
    Dim tBRep As TransientBRep
    Set tBRep = ThisApplication.TransientBRep
    
    Dim bodyDef As SurfaceBodyDefinition
    Set bodyDef = tBRep.CreateSurfaceBodyDefinition
    
    Dim lumpDef As LumpDefinition
    Set lumpDef = bodyDef.LumpDefinitions.Add
    
    Dim shellDef As FaceShellDefinition
    Set shellDef = lumpDef.FaceShellDefinitions.Add
    
    Dim pl As Plane
    Set pl = tg.CreatePlane(tg.CreatePoint(0, 0, 0), tg.CreateVector(0, 0, 1))
    
    Dim faceDef As FaceDefinition
    Set faceDef = shellDef.FaceDefinitions.Add(pl, False)
    
    Dim circ As Inventor.Circle
    Set circ = tg.CreateCircle(tg.CreatePoint(0, 0, 0), tg.CreateUnitVector(0, 0, 1), 3)
    
    Dim vert1 As VertexDefinition
    Set vert1 = bodyDef.VertexDefinitions.Add(tg.CreatePoint(3, 0, 0))
    
    Dim vert2 As VertexDefinition
    Set vert2 = bodyDef.VertexDefinitions.Add(tg.CreatePoint(3, 0, 0))
    
    Dim edgeDef As EdgeDefinition
    Set edgeDef = bodyDef.EdgeDefinitions.Add(vert1, vert2, circ)
    
    Dim loopDef As EdgeLoopDefinition
    Set loopDef = faceDef.EdgeLoopDefinitions.Add
    
    Call loopDef.EdgeUseDefinitions.Add(edgeDef, False)
    
    Dim body As SurfaceBody
    Dim errors As NameValueMap
    Set body = bodyDef.CreateTransientSurfaceBody(errors)
    
    Set cg = partDoc.ComponentDefinition.ClientGraphicsCollection.Add("Fill Test")
    
    Dim node As GraphicsNode
    Set node = cg.AddNode(1)
    
    Dim surfGraphics As SurfaceGraphics
    Set surfGraphics = node.AddSurfaceGraphics(body)
    surfGraphics.Color = ThisApplication.TransientObjects.CreateColor(255, 0, 0, 1)
    
    ThisApplication.ActiveView.Update
End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 18:41:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3863361#M131415</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2013-04-12T18:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Client Graphics - Circle Fill Colour</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3863364#M131416</link>
      <description>&lt;P&gt;Does anyone know the trick to posting code so the blank lines aren't taken out?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 18:42:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3863364#M131416</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2013-04-12T18:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Client Graphics - Circle Fill Colour</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3871258#M131417</link>
      <description>&lt;P&gt;Hi Brian, thanks for your response. You're right, it is complex &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; more so than i anticipated to achieve the circle, but i like a good challenge. Would there be any drawbacks using this method compared to triangle fans with regard to performance?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards, Matt.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Apr 2013 10:30:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3871258#M131417</guid>
      <dc:creator>matt_jlt</dc:creator>
      <dc:date>2013-04-14T10:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Client Graphics - Circle Fill Colour</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3887684#M131418</link>
      <description>&lt;P&gt;I don't know for sure about performance of creating surface graphics vs. triangle graphics.&amp;nbsp; It would take some timing tests to see how much difference there is.&amp;nbsp; It's only a concern if you're creating a lot of the circles.&amp;nbsp; In that case you can create the first one using surface graphics and then create the others by copying the graphics node and positioning it where the new circle needs to be.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2013 00:15:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3887684#M131418</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2013-04-25T00:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Client Graphics - Circle Fill Colour</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3902980#M131419</link>
      <description>&lt;P&gt;Hi Matt,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The subroutine below can be used for drawing circle as traingle fans.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ishwar N&lt;/P&gt;
&lt;PRE&gt;Public Sub AddCircleGraphics( _
    ByVal oDoc As Document, _
    ByVal oCircleNode As GraphicsNode, _
    ByVal cpt As Point, _
    ByVal norm As UnitVector, _
    ByVal dRadius As Double)
    
    
    Dim oDataSets As GraphicsDataSets
    If oDoc.GraphicsDataSetsCollection.Count &amp;gt; 0 Then
        oDoc.GraphicsDataSetsCollection.Item(1).Delete
    End If

    Set oDataSets = ThisApplication.ActiveDocument.GraphicsDataSetsCollection.Add(oCircleNode.Parent.ClientId)
    
    ' Create a coordinate set.
    Dim oCoordSet As GraphicsCoordinateSet
    Set oCoordSet = oDataSets.CreateCoordinateSet(1)

    ' No of sides to approximate the circle
    Dim iSideCount As Long
    iSideCount = 100
    

    
    ' Create an array containing points to used in drawing the circle as trainglefan graphics.
     
     Dim adPointCoords() As Double
     ReDim adPointCoords(1 To (iSideCount + 1) * 3) As Double
     Dim i As Long
     Dim dAngle As Double
     
  
     ' Define the points for the outline of the Circle.
     dAngle = 0
     For i = 0 To iSideCount - 1
         adPointCoords(i * 3 + 1) = cpt.X + dRadius * Cos(dAngle)
         adPointCoords(i * 3 + 2) = cpt.Y + dRadius * Sin(dAngle)
         adPointCoords(i * 3 + 3) = 0
         
         ' Increment the angle for the next point
         dAngle = dAngle + ((2 * 3.14159265358979) / iSideCount)
     Next
     
  
     ' Define coordinate at the center
      adPointCoords(iSideCount * 3 + 1) = cpt.X
      adPointCoords(iSideCount * 3 + 2) = cpt.Y
      adPointCoords(iSideCount * 3 + 3) = 0
 
     ' Assign the points to the coordinate set.
     Call oCoordSet.PutCoordinates(adPointCoords)
     
     ' Create a triangle fan
     Dim oCircleTriangleFan As TriangleFanGraphics
     Set oCircleTriangleFan = oCircleNode.AddTriangleFanGraphics

 
     ' Set the coordinates and Color
     oCircleTriangleFan.CoordinateSet = oCoordSet
     oCircleNode.RenderStyle = ThisApplication.ActiveDocument.RenderStyles.Item("Red")
     
     ' update the display to see the results.
     ThisApplication.ActiveView.Update
     
     ' Define a normal for circle.
     Dim oCircleNormals As GraphicsNormalSet
     Set oCircleNormals = oDataSets.CreateNormalSet(1)
     Call oCircleNormals.Add(1, norm)
     
     ' Assign the normals to the circle.
     oCircleTriangleFan.NormalSet = oCircleNormals
   
    
     ' update the display to see the results.
     ThisApplication.ActiveView.Update

End Sub
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2013 10:15:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/client-graphics-circle-fill-colour/m-p/3902980#M131419</guid>
      <dc:creator>nagwani</dc:creator>
      <dc:date>2013-05-02T10:15:59Z</dc:date>
    </item>
  </channel>
</rss>

