Announcements

Community notifications may experience intermittent interruptions between 10–12 November during scheduled maintenance. We appreciate your patience.

Get geometry primitive in Navisworks

Get geometry primitive in Navisworks

nasip13904
Participant Participant
1,078 Views
8 Replies
Message 1 of 9

Get geometry primitive in Navisworks

nasip13904
Participant
Participant

Hi all,

I'm using Geometry.PrimitiveType to get geometry primitive but in this api call i am getting Triangleorline result but I want to get specific result is that line or not as I just need customize the line data. is their any way to get that

 

nasip13904_0-1679854077169.png

nasip13904_0-1679854963745.png

 

 

0 Likes
1,079 Views
8 Replies
Replies (8)
Message 2 of 9

naveen.kumar.t
Autodesk Support
Autodesk Support

HI @nasip13904 ,

 

Could you please try using this below code?

ModelItem item=doc.CurrentSelection.SelectedItems.First();
if(item.Geometry.PrimitiveTypes!=null && item.Geometry.PrimitiveTypes is PrimitiveTypes.Triangles)
{
 //Your code
}           
else if(item.Geometry.PrimitiveTypes != null && item.Geometry.PrimitiveTypes is PrimitiveTypes.Lines)
{
 //Your code
}
else
{
 //Your code
}


If this doesn;t help, could you please send me a simple non-confidential file and explain the issue?


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 9

eduardo_salvador02
Enthusiast
Enthusiast

Hello! 

I have another problem, If you have some time and can take a look, I'd be grateful.

I need to disable the geometry display options in the "Viewpoint" Ribbon. But I'm not finding the right method for this.

Below is the photo that I need to disable.

ti_eduardo_0-1701697758981.png

These are the guys I need to disable.

I'm waiting.

0 Likes
Message 4 of 9

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @eduardo_salvador02 ,

 

Do you want to disable those buttons or Do you want to turn of/off those buttons?

 

I tried to disable the buttons but it is not working as expected.

 

Here is the sample code to turn on/off those buttons

 

string commandId1 = "RoamerGUI_OM_PRIMITIVE_TRIANGLES";
            string commandId2 = "RoamerGUI_OM_PRIMITIVE_LINES";
            string commandId3 = "RoamerGUI_OM_PRIMITIVE_SNAP_POINTS";
            string commandId4 = "RoamerGUI_OM_PRIMITIVE_TEXT";
            string commandId5 = "RoamerGUI_OM_PRIMITIVE_POINTS";
            Autodesk.Navisworks.Api.Interop.LcUCIPExecutionContext av = Autodesk.Navisworks.Api.Interop.LcUCIPExecutionContext.eTOOLBAR;
            try
            {
                Autodesk.Navisworks.Api.Interop.LcRmFrameworkInterface.ExecuteCommand(commandId1, av);
                Autodesk.Navisworks.Api.Interop.LcRmFrameworkInterface.ExecuteCommand(commandId2, av);
                Autodesk.Navisworks.Api.Interop.LcRmFrameworkInterface.ExecuteCommand(commandId3, av);
                Autodesk.Navisworks.Api.Interop.LcRmFrameworkInterface.ExecuteCommand(commandId4, av);
                Autodesk.Navisworks.Api.Interop.LcRmFrameworkInterface.ExecuteCommand(commandId5, av);
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("This tool does not appear to be supported");
            }

Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 9

eduardo_salvador02
Enthusiast
Enthusiast

Hi!

I want to turn off these buttons, by default it is on.

I tested this code below in my environment, but it did not turn off the buttons.

0 Likes
Message 6 of 9

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @eduardo_salvador02 ,

 

I tested the sample code, and it is working fine at my end.

By default, the buttons are "on". I used the above sample code to turn "off" the buttons.

I am not aware of any other way to turn on or off these buttons.
The NW engineering team said primitive display is not be exposed via the .NET API.

So, I am not aware of any other solutions.


Before:
Before.png


After:
After.png


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 7 of 9

eduardo_salvador02
Enthusiast
Enthusiast

I managed to find the problem, it was that my code is using the same thing inside a Form that overwrote the navisworks Application, preventing the code from executing successfully. I put it outside the form and it worked! Thank you very much!

0 Likes
Message 8 of 9

eduardo_salvador02
Enthusiast
Enthusiast

Hello, I'm back again, haha.

Do you know if there's any other way to disable these items other than through the command ID? I couldn't find any way to control the state of this button before executing it, and it used to happen that the button was already disabled, and then it would enable it.

I tried searching everywhere, but I couldn't find anything about disabling the rendering of Lines, Points, and SnapPoints.

0 Likes
Message 9 of 9

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @eduardo_salvador02 ,

 

I don’t believe the display settings are exposed anywhere in the .NET API for direct access.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes