Setting the DISPLAY Material Property

Setting the DISPLAY Material Property

Anonymous
Not applicable
327 Views
5 Replies
Message 1 of 6

Setting the DISPLAY Material Property

Anonymous
Not applicable
Not to be confused with the actual material property.  At
the top of the screen in Inventor 6, the display material is often called "As
Material."  Is there any way to access this in the API.

 

Thanks in advance for the help.

 

 

 

 

 
0 Likes
328 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
I use an Autosave Sub to create a custom property
which I then call into my IDW title block.

 

I got the original code as a sheet metal style
property set from either Kent or Sean I think and just modified it slightly for
the ActiveRenderStyle.

 

 

   ' Create or update the property
containing the active colour.
    Dim strColorName As
String
    strColorName =
ThisDocument.ActiveRenderStyle.Name

 

    On Error Resume
Next
    oCustomPropSet.Item("Finish").Value =
strColorName
    If Err
Then
       
Err.Clear
        Call
oCustomPropSet.Add(strColorName, "Finish")
    End
If
    On Error GoTo 0

 

 

Jas


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Not to be confused with the actual material property.  At
the top of the screen in Inventor 6, the display material is often called "As
Material."  Is there any way to access this in the API.

 

Thanks in advance for the help.

 

 

 

 

 
0 Likes
Message 3 of 6

Anonymous
Not applicable
Thanks!


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

I use an Autosave Sub to create a custom property
which I then call into my IDW title block.

 

I got the original code as a sheet metal style
property set from either Kent or Sean I think and just modified it slightly
for the ActiveRenderStyle.

 

 

   ' Create or update the property
containing the active colour.
    Dim strColorName As
String
    strColorName =
ThisDocument.ActiveRenderStyle.Name

 

    On Error Resume
Next
    oCustomPropSet.Item("Finish").Value =
strColorName
    If Err
Then
       
Err.Clear
        Call
oCustomPropSet.Add(strColorName, "Finish")
    End
If
    On Error GoTo 0

 

 

Jas


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Not to be confused with the actual
material property.  At the top of the screen in Inventor 6,
the display material is often called "As Material."  Is there any way
to access this in the API.

 

Thanks in advance for the help.

 

 

 

 

 
0 Likes
Message 4 of 6

Anonymous
Not applicable
This works... The material is changed
to whatever the active render style desired is in the combobox, however, the
actual color of the object stays at the default.  Might there be another
undocumented (as I find no documentation on any of this) property besides Name
that needs to be set?


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

I use an Autosave Sub to create a custom property
which I then call into my IDW title block.

 

I got the original code as a sheet metal style
property set from either Kent or Sean I think and just modified it slightly
for the ActiveRenderStyle.

 

 

   ' Create or update the property
containing the active colour.
    Dim strColorName As
String
    strColorName =
ThisDocument.ActiveRenderStyle.Name

 

    On Error Resume
Next
    oCustomPropSet.Item("Finish").Value =
strColorName
    If Err
Then
       
Err.Clear
        Call
oCustomPropSet.Add(strColorName, "Finish")
    End
If
    On Error GoTo 0

 

 

Jas


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Not to be confused with the actual
material property.  At the top of the screen in Inventor 6,
the display material is often called "As Material."  Is there any way
to access this in the API.

 

Thanks in advance for the help.

 

 

 

 

 
0 Likes
Message 5 of 6

Anonymous
Not applicable
Functionally, dealing with
ActiveRenderStyle.Name changes the combobox text for the render style, but does
not change the object itself!  Might there be another parameter to
set?

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Thanks!


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

I use an Autosave Sub to create a custom
property which I then call into my IDW title block.

 

I got the original code as a sheet metal style
property set from either Kent or Sean I think and just modified it slightly
for the ActiveRenderStyle.

 

 

   ' Create or update the property
containing the active colour.
    Dim strColorName As
String
    strColorName =
ThisDocument.ActiveRenderStyle.Name

 

    On Error Resume
Next
    oCustomPropSet.Item("Finish").Value =
strColorName
    If Err
Then
       
Err.Clear
        Call
oCustomPropSet.Add(strColorName, "Finish")
    End
If
    On Error GoTo 0

 

 

Jas


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Not to be confused with the actual
material property.  At the top of the screen in Inventor 6,
the display material is often called "As Material."  Is there any way
to access this in the API.

 

Thanks in advance for the help.

 

 

 

 

 
0 Likes
Message 6 of 6

Anonymous
Not applicable
Maybe this will help?

'get the current render color before changing the material
Rendercolor = oDoc.ActiveRenderStyle.Name

'set the material....Material is a variable with the name of the material
Set oMaterial = oDoc.Materials.Item(Material)
oDoc.ComponentDefinition.Material = oMaterial

'if you want to then reset the color back to the original color
'cbColor = a checkbox marked "Keep Part Color"
If cbColor.Value = True Then
oDoc.ActiveRenderStyle = oDoc.RenderStyles.Item(Rendercolor)
End If


--
Sean Dotson, PE
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
"Stephen Anderson" wrote in message
news:487E80DBE344B118883904A540848029@in.WebX.maYIadrTaRb...
> Not to be confused with the actual material property. At the top of the
screen in Inventor 6, the display material is often called "As Material."
Is there any way to access this in the API.
>
> Thanks in advance for the help.
>
>
>
>
>
0 Likes