.VB Journal NX5
.VB Journal NX5
(OP)
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?





RE: .VB Journal NX5
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
RE: .VB Journal NX5
Seemss like its definitely on the right track. Appreciate your input. However, I'm getting an error saying 'UFSession' is not defined.
RE: .VB Journal NX5
Any ideas...anyone?
RE: .VB Journal NX5
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
RE: .VB Journal NX5
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?
RE: .VB Journal NX5
ufs.modl.obj.deleteobject(objs(i).tag)
to
ufs.ufobj.deleteobject(objs(i).tag)
RE: .VB Journal NX5
ufs.modl.obj.deleteobject(objs(i).tag)
to
ufs.obj.deleteobject(objs(i).tag)
RE: .VB Journal NX5