Client Graphics Color change

Client Graphics Color change

FINET_Laurent
Advisor Advisor
219 Views
2 Replies
Message 1 of 3

Client Graphics Color change

FINET_Laurent
Advisor
Advisor

Hi folks,

 

I'm drawing a nice cylinder in an assembly environement using the client graphics with this code :

Dim doc As Inventor.AssemblyDocument = ThisApplication.ActiveDocument
Dim acd As Inventor.AssemblyComponentDefinition = doc.ComponentDefinition

Dim tg As Inventor.TransientGeometry = ThisApplication.TransientGeometry
Dim treb As Inventor.TransientBRep = ThisApplication.TransientBRep

Dim p1 As Inventor.Point = tg.CreatePoint(0, 0, 0)
Dim p2 As Inventor.Point = tg.CreatePoint(0, 0, 100)

Dim sfb As Inventor.SurfaceBody = treb.CreateSolidCylinderCone(p1, p2, 10, 10, 10)

Dim cg As Inventor.ClientGraphics = acd.ClientGraphicsCollection.Add("Test")
Dim n As Inventor.GraphicsNode = cg.AddNode(1)

Dim s As Inventor.SurfaceGraphics = n.AddSurfaceGraphics(sfb)

ThisApplication.ActiveView.Update

 

FINET_Laurent_0-1702383572184.png

 

I would like to change it's color to transparent blue by code. I've been playing with color properties but with no luck.


Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
220 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @FINET_Laurent.  I'm just guessing here, but there are a few properties I am seeing that may be worth checking out.

SurfaceGraphics.Color (the fourth Color spec is for opacity).

GraphicsNode.Appearance 

GraphicsNode.IsTransparentInPlaceEdit 

GraphicsNode.OverrideOpacity 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

FINET_Laurent
Advisor
Advisor

Hi @WCrihfield 

 

I've been playing with  SurfaceGraphics.Color, GraphicsNode.IsTransparentInPlaceEdit, GraphicsNode.OverrideOpacity 

..with no actual result. I might be missing something, but the color property is throwing errors & the others have no visual effects.. I indeed started digging the appearances assets & came with this :

Dim doc As Inventor.AssemblyDocument = ThisApplication.ActiveDocument
Dim acd As Inventor.AssemblyComponentDefinition = doc.ComponentDefinition

Dim tg As Inventor.TransientGeometry = ThisApplication.TransientGeometry
Dim treb As Inventor.TransientBRep = ThisApplication.TransientBRep

Dim p1 As Inventor.Point = tg.CreatePoint(0, 0, 0)
Dim p2 As Inventor.Point = tg.CreatePoint(0, 0, 100)

Dim sfb As Inventor.SurfaceBody = treb.CreateSolidCylinderCone(p1, p2, 10, 10, 10)

Dim cg As Inventor.ClientGraphics = acd.ClientGraphicsCollection.Add("Test")
Dim n As Inventor.GraphicsNode = cg.AddNode(1)

Dim s As Inventor.SurfaceGraphics = n.AddSurfaceGraphics(sfb)

'Change Appearance -----------------------------------------------------
Dim targetAppearance As Asset

Try
	targetAppearance = doc.Assets.Item("Water-008")

Catch
	Dim sourceAppearance As Asset = ThisApplication.AssetLibraries.Item(2).AppearanceAssets.Item("Water-008")'
	sourceAppearance.CopyTo(doc)
	targetAppearance = doc.Assets.Item("Water-008")
	
End Try

n.Appearance = targetAppearance

ThisApplication.ActiveView.Update

FINET_Laurent_0-1702394717909.png

It is an ok result as for now but I'm still hoping for something else.. for instance using the .color property which looks better suited.. 

 

Kind regards,

FINET L.

 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill