Hello-
I am trying to change the color of a sketch point in a 3d sketch through the Inventor API based on the file state in Vault. Currently I have all parts working, with the exception of setting the point color.
I would like to replicate the result obtainable through the UI by navigating to the point in question, rt. click on the 3d sketch->Properties-> then set the color.
The basics of my set color function are shown below in a VBA snippet:
Dim thePartDoc As PartDocument
Set thePartDoc = ThisApplication.ActiveDocument
Dim partComp As PartComponentDefinition
Set partComp = thePartDoc.ComponentDefinition
Dim threeDSketch As Sketch3D
Set threeDSketch = partComp.Sketches3D.Item(1)
Dim red As Inventor.Color
Set red = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
threeDSketch.OverrideColor = red
However, this does not produce the desired result.
I also tried using the point object within the 3d sketch iteself (threeDSketch.SketchPoints3D.Item(1) ), but this does not appear to have a color setting. I then tried to capture the event throught the Event Watcher, but this did not produce a result that I was able to replicate, even using a selection set.
Does anyone have any ideas or thoughts? I have attached a sample file.
Ultimately these points are being used in an assembly collection of points, so if the color can be changed at the assembly level that is a valid solution as well.
Solved! Go to Solution.
Solved by Carter.Mast. Go to Solution.
Unfortunately I couldn't find a way to achieve the color change like in the UI... I asked the API Team and I will let you know if I get a positive feedback.
Regards,
Philippe.
Thank you for your reply.
Fortunatly I was able to accomplish my goal using code similar to that shown above.
The trick? Make sure the color property for the sketch is set to "Default". This will allow changes through the UI.
My previous attempts had the skecth color set to "Yellow", thus negating/overriding the command from the API.
See image below.
Thanks for your help in looking into this.
Carter
Yes setting the color at the sketch level with the API only works if the sketch and the contained entities have their color set to default in the UI.
We also have a request logged to expose sketch entity color to the APi but it hasn't been implemented yet.
Thanks for letting us know,
Philippe.