Showing results for 
Search instead for 
Do you mean 

Deleting from a specific area of a specific layer

I'm working on an NXOpen app that creates a drawing on a template imported from teamcenter. The template is set up with manual drawing creation in mind, and as such has a bunch of placeholder notes and symbols in the lower left corner. They need to be hidden or deleted. They're all on one layer, but share that layer with other objects that cannot be deleted. It would be fantastic if I could return all the objects inside box of a defined size and delete/hide them. Is there any way this would be possible?


Re: Deleting from a specific area of a specific layer

You could always cycle thru all notes on the sheet, get their origin, and then delete based on that.

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: Deleting from a specific area of a specific layer

Yes, this is possible. You will need to determine the bounds around the temp objects. Cycle through the objects checking the origin of each; if the object lies within the bounds, hide or delete it as necessary.


I have some similar code I can post if it will help, I wrote it to report the drawing title of our drawings. I determined the bounds of the title block note from our old drawing templates (they don't use tabular notes or title blocks, just lines & notes); the journal code checks the sheet size and looks for a note object in the corresponding rectangular area.


As an alternative, you may want to assign a certain attribute to each of the temp objects in your template file. As you cycle through the objects, you can check the value (or existence) of a certain attribute and hide/delete accordingly. Or, you may want to add all the temp objects to a group so you can easily hide/delete the entire group.

Re: Deleting from a specific area of a specific layer

So I'm looping through all the objects in a layer and trying to find each origin is within the bounds of my deletion area, but I'm having some issues.


My first instinct was to get the origin via the .AnnotationOrigin property. However, the objects I need to delete aren't all notes, theres a few CustomSymbol and IdSymbol objects as well, meaning I have to identify what type the object is and parse it to the correct datatype before using .AnnotationOrigin. I have not found a way to do this in a robust manner.


I've also played with using UF wrappers to do this, in the hopes that I could use something in UFSession.Obj or UFObj to find the object origin and delete it directly without having to find out the type and parse it. However, UF is so poorly documented that I haven't had much success.


Does anyone have any suggestions as to how I should proceed?

Re: Deleting from a specific area of a specific layer

You could approach from the other direction; loop through the note collection, ID symbol collection, and custom symbol collection checking the layer and annotation origin properties...

Re: Deleting from a specific area of a specific layer

Not sure why you would need to find the specific object type. As long as it is a type that extends Annotation, which all three that you mentioned do, you should be able to call the AnnotationOrigin() method.

I'm assuming when you loop through objects on your layer they are simply NXObject. You should then be able to do something like:

if(theNxObject instanceof nxopen.annotations.Annotation){
  nxopen.annotations.Annotation theAnnotation=
      (nxopen.annotations.Annotation) theNxObject;
  // Do whatever with the Annotation object, eg:
  // theAnnotation.annotationOrigin();


Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5