Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Get the state/layer from a Geom object

Hi,

 

(NXOpen JAVA)

 

I have a part that contains several layers, like you can see in the pictures below:

 

states_01.pngstates_02.png

 

My question is this:

How can I get the matching state (2017-04-19 14_47_32-Jasc Paint Shop Pro - states_02.png) of each Geom ( 2017-04-19 14_46_28-NX 11 - Manufacturing - [test_dir.prt (Modified) ].png)?

(Assumming that in the original file only one state is presented and I already got all the Geom objects).

 

Thanks,

Tom.

10 REPLIES

Re: Get the state/layer from a Geom object

Objects that inherit from the DisplayableObject class have a .Layer property that you can query to see what layer the object resides on. Once you know the layer, you can use the layer manager's .GetState method to find the layer state (work layer, selectable, visible, or hidden).

Re: Get the state/layer from a Geom object

If the "Geom" is not a displayable object (or even if it is), note you might have multiple solids selected (one for blank, one for part, possibly others) that may EACH be on separate layers.

So you may have to ask the "geometry" group parent for the various solids that are its "children" & find the layer(s) of those solids.

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Get the state/layer from a Geom object

Thank you for your help.

 

I got the Geom

			nxopen.cam.FeatureGeometry featureGeometry1 = ((nxopen.cam.FeatureGeometry)m_WorkPart.camsetup().camgroupCollection().findObject("YOLO_1"));
			nxopen.cam.MillGeomBuilder millGeomBuilder1;
			millGeomBuilder1 = m_WorkPart.camsetup().camgroupCollection().createMillGeomBuilder(featureGeometry1);

 But I don't understand how to continue from here.

 

Thanks,

Tom.

Re: Get the state/layer from a Geom object

Is it even possible?

Re: Get the state/layer from a Geom object

Have you already checked out if "Save Layer and Layout" would be sufficient?

Sure you have to hit "save layer and layout" once when you have finished editing the geometry, but afterwards things should be no problem.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Get the state/layer from a Geom object

My main issue is to get the layer number from the 2017-04-19 14_46_28-NX 11 - Manufacturing - [test_dir.prt (Modified) ].png.

Solution
Solution
Accepted by topic author TomLeon
‎04-26-2017 03:05 AM

Re: Get the state/layer from a Geom object

If you just need this to switch the layer settings, this is already available using "Save Layer and Layout" from within the geometry object and "Switch Layer and Layout" from the context menu of the geometry object.

If you need this for something different, then you need the following steps:

  1. cycle through the geometry group objects
  2. get each body of the specified part geometry
  3. check which layers contain the bodies

What is the goal you are trying to realize?

If we know what task you are trying to automate, we can better help you with the many ways that are available.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community
Solution
Solution
Accepted by topic author TomLeon
‎04-26-2017 03:05 AM

Re: Get the state/layer from a Geom object

[ Edited ]

My final goal is this:

For each 2017-04-19 14_46_28-NX 11 - Manufacturing - [test_dir.prt (Modified) ].png I need to display only the relevant layer and run the "find features" option.

(Then I do some calculations, I delete the features, and move to the next 2017-04-19 14_46_28-NX 11 - Manufacturing - [test_dir.prt (Modified) ].png)

 

EDIT:

Thanks for your reply I managed to reach from the Geom to the relevant layer:

			Geometry part = geom.partGeometry();
			GeometrySetList gList = part.geometryList();
			GeometrySet[] content = gList.getContents();
			for(GeometrySet set : content)
			{
				TaggedObject[] items = set.getItems();
				for(TaggedObject item : items)
				{
					Body body = (Body) item;
					System.out.println(body.layer());
				}
			}

 

another little question: Is there an efficient way to get the name of the Geom parent of an operation?

 

Thanks again,

Tom.

 

Re: Get the state/layer from a Geom object


TomLeon wrote:

 

another little question: Is there an efficient way to get the name of the Geom parent of an operation?

 

 


I didn't test it, but I would guess:

Dim GeomGroup as NCGroup = myOp.GetParent(CAMSetup.View.Geometry)
Dim GroupName as String = GeomGroup.Name 
Mark Rief
Retired Siemens