Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

.VB Journal NX5 1

Status
Not open for further replies.

hurley710

Automotive
Joined
Feb 4, 2009
Messages
59
Location
US
I'm writing a journal that will essentially "wipe a titleblock clean" in the case I am doing a quick Save As of an existing cad file. I need to figure out a way to delete everything on layer 249 in a journal. Any ideas?
 
I think this should work, but I haven't tried it:


Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim workPart As Part = theSession.Parts.Work
dim objs as NXObject()=workpart.layers.getallobjectsonlayer(249)

for i as integer = 0 to objs.length-1
ufs.modl.obj.deleteobject(objs(i).tag)
next
 
claforet,

Seemss like its definitely on the right track. Appreciate your input. However, I'm getting an error saying 'UFSession' is not defined.
 
Hurley710,


Make sure that near the top of the file where the other "Imports ??????" lines are that you have the line

Imports NXOpen.UF

That line is not included in the boilerplate "tools -> journal -> new" code.

HTH, Joe
 
Joe,
Thanks for the help. I already had 'Imports NXOpen' as a line so I added 'Imports NXOpen.UF' below that. That seems to have eliminated the 'UFSession' not defined error.
Now the error I see reads: 'obj' is not a member of 'NXOpen.UF.UFModl' This pertains to the following line: ufs.modl.obj.deleteobject(objs(i).tag) Any ideas?
 
OK. Try changing the line

ufs.modl.obj.deleteobject(objs(i).tag)

to

ufs.ufobj.deleteobject(objs(i).tag)
 
Scratch that last post. Change

ufs.modl.obj.deleteobject(objs(i).tag)

to

ufs.obj.deleteobject(objs(i).tag)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top