Autodesk Navisworks API
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
3th party apps VS 2010 Color
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
HI all
This time i really need your help. I am traying change the color of an object. Let me explain please.
1. Select a button that has the next code Autodesk.Navisworks.Api.Application.ActiveDocument
2. I select a object (pipe) and then ...
3. Press the other button to change the color of that object.
I dont have much experience.... please help me. Attached a screenshot.
Regards
Sergio Franco.
Solved! Go to Solution.
Re: 3th party apps VS 2010 Color
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sergio,
See If This Works
//Begin Code using NavAPI = Autodesk.Navisworks.Api; // m_Color should be the Color Selected example: #FFFFFF System.Windows.Media.Color m_CompColor =(Color)System.Windows.Media.ColorConverter.ConvertFromString ( m_Color ); // NavAPI.Application.ActiveDocument.Models.OverrideP ermanentColor ( NavAPI.Application.ActiveDocument.CurrentSelection .SelectedItems, new NavAPI.Color ( Convert.ToDouble(m_CompColor.R) / 255, Convert.ToDouble(m_CompColor.G) / 255, Convert.ToDouble(m_CompColor.B) / 255 ) ); //End Code
Re: 3th party apps VS 2010 Color
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sergio,
I forgot to add this line of Code at the Very end
NavAPI.Application.ActiveDocument.CurrentSelection.Clear();
Colin
Re: 3th party apps VS 2010 Color
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
KempCE
Just one error appears, "m_color does not exist in the current context" for try if this works. Help me please...
Regards,
SF
Re: 3th party apps VS 2010 Color
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sergio,
In your picture you showed a Button with a Color that the User Selects to change the color. Change m_Color to that Color Selection
Regards,
Colin
Re: 3th party apps VS 2010 Color
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
KemCE
the code is..
string color = "RED";
// m_Color should be the Color Selected example: #FFFFFF
System.Windows.Media.Color m_CompColor = (System.Drawing.Color)System.Windows.Media.ColorCo
(color
);
//
Autodesk.Navisworks.Api.Application.ActiveDocument
(
Autodesk.Navisworks.Api.Application.ActiveDocument
new Autodesk.Navisworks.Api.Color
(
Convert.ToDouble(m_CompColor.R) / 255,
Convert.ToDouble(m_CompColor.G) / 255,
Convert.ToDouble(m_CompColor.B) / 255
)
);
Autodesk.Navisworks.Api.Application.ActiveDocument
when i change m_color by color that is "string color ="RED;". Appears an error "Cannot implicity convert type"System.Drawing.Color" to "System.Windows.Media.Color" ". Please am i doing something wrong??
Regards,
SF
Re: 3th party apps VS 2010 Color
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sergio,
you will need the R,G,B Hex Color String.
Red = #FF0000
Regards,
Colin
Re: 3th party apps VS 2010 Color
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Colin
Thanks a lot, again...
here is the code
System.Drawing.Color c = System.Drawing.Color.Red;
string strcolor = System.Drawing.ColorTranslator.ToHtml(c);
//Autodesk.Navisworks.Api.Application.ActiveDocume
// m_Color should be the Color Selected example: #FFFFFF
System.Windows.Media.Color m_CompColor = (System.Windows.Media.Color)System.Windows.Media.C
(strcolor
);
//
Autodesk.Navisworks.Api.Application.ActiveDocument
(
Autodesk.Navisworks.Api.Application.ActiveDocument
new Autodesk.Navisworks.Api.Color
(
Convert.ToDouble(m_CompColor.R) / 255,
Convert.ToDouble(m_CompColor.G) / 255,
Convert.ToDouble(m_CompColor.B) / 255
)
);
Autodesk.Navisworks.Api.Application.ActiveDocument
Regards,
SF
Re: 3th party apps VS 2010 Color
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Colin
I am very grateful for your help. Please could you help me with the next.
I am trying to use the function "HIDE UNSELECTED" from my app. I try with the next...
private void button14_Click(object sender, EventArgs e)
{
Autodesk.Navisworks.Api.Application.ActiveDocument
Autodesk.Navisworks.Api.Application.ActiveDocument
}
but the result is other. How can i do it??
Please Help.
Best Regards,
SF
