Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

color partFeatures

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
intentdesign
698 Views, 6 Replies

color partFeatures

Within an IvAdoptedPart I drive a hole with the following code:

 

    Child hole As :IvPartHoleFeature
        diameter=10
        cboreDiameter=15
        cboreDepth=12
        face="oben"
        edge1="links_oben"
        edge2="vorne_oben"
        distance1=50
        distance2=120
        biasPoint="Ursprung"
        throughAllType=:ThroughAll
        extentDirection=:positive
    End Child

 

Now I would like to change the color of the hole feature:

 

    Rule TestColor As Boolean
        Dim InventorComponent As Any = gethostobject(Me).definition.document
        Dim NewRenderStyleObject As Any = InventorComponent.RenderStyles.get_Item("Red")

        Dim oPartFeature As Any = GetHostObject(hole)
        oPartFeature.SetRenderStyle(StyleSourceTypeEnum.kOverrideRenderStyle, NewRenderStyleObject)

        Return True
    End Rule

 

Changing the color does'nt work. What's wrong?

 

I'm working with Inventor ETO 2014.

 

Thanks,

Dieter

 

6 REPLIES 6
Message 2 of 7
Lesoux
in reply to: intentdesign

Why you didn't try to create hole in factory file and suppress/unsuppress feature if necessary?

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Message 3 of 7
AlexKorzun
in reply to: Lesoux

I've added the Inventor namespace into enumeration, and "it works".

 

 

' Written by Intent
Design aaa : ETO_SamplesRoot PartHole_Part01
    '
    Child simpleLinearHole As :IvPartHoleFeature
        face = "TopFace"
        edge1 = "TopFrontEdge"
        edge2 = "TopLeftEdge"
        distance1 = 11
        distance2 = 12
        biasPoint = "v001"
        extentDirection = :Positive
        diameter = 10
        cboreDiameter = 15
        cboredepth=12
        throughAllType = :throughAll
    End Child    
 
 Rule TestColor As Any
        Dim InventorComponent As Any = gethostobject(Me).definition.document
        Dim NewRenderStyleObject As Any = InventorComponent.RenderStyles.get_Item("Red")

        Dim oPartFeature As Any = GetHostObject(simpleLinearHole)
        oPartFeature.SetRenderStyle(Inventor.StyleSourceTypeEnum.kOverrideRenderStyle, NewRenderStyleObject)
'
        Return oPartFeature
 End Rule
    
End Design

 

aaa.jpg

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Message 4 of 7
intentdesign
in reply to: AlexKorzun

Hi Alex

 

That works fine now.

Can you please tell me how to add a parameter named "color" to the IvPartHoleFeature  design that colors the feature directly?

 

Thanks

Dieter

Message 5 of 7
AlexKorzun
in reply to: intentdesign

Hi Dieter,

 

Though it might change in future, please try overriding the modelself Rule for the part with the hole chile, injecting the code:

 

'  Written by Intent
Design aaa : ETO_SamplesRoot PartHole_Part01
    'Add the drilled hole feature
    Child simpleLinearHole As :PartHoleFeaturewithcolor
        'drilledType = :Drilled
        face = "TopFace"
        edge1 = "TopFrontEdge"
        edge2 = "TopLeftEdge"
        distance1 = 11
        distance2 = 12
        biasPoint = "v001"
        extentDirection = :Positive
        diameter = 10
        cboreDiameter = 15
        cboredepth=12
        throughAllType = :throughAll
    End Child    

    < %%category(""), _
        %%choices("%%colorChoices"), _
        %%PEAllowOther?("True"), _
        %%evalChoices("True") > _
  Parameter Rule FeatureColor As String = "red"

  Rule modelSelf As List
    memberPathname
    Dim ret As List =  { %%updateSelf }
    
     Dim InventorComponent As Any = GetHostObject( Me).definition.document
     Dim NewRenderStyleObject As Any = InventorComponent.RenderStyles.get_Item( FeatureColor)

    Dim oPartFeature As Any = Gethostobject(simpleLinearHole)
    oPartFeature.SetRenderStyle(Inventor.StyleSourceTypeEnum.kOverrideRenderStyle, NewRenderStyleObject)
    
    Return ret
  End Rule

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Message 6 of 7
intentdesign
in reply to: AlexKorzun

Thanks Alex, that works.

 

Dieter

Message 7 of 7
AlexKorzun
in reply to: intentdesign

Hi Dieter,

 

The only remaining thing is to mix the FeatureColor into part's signature, if it is required.

 

The simplest is to create a dummy string parameter, include it into %%paramList.

OR

modify iProperties Rule to containt the similar to:

  Parameter Rule iProperties As List = {{"FC", FeatureColor}}

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report