×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

.VB Journal NX5

.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

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

RE: .VB Journal NX5

(OP)
claforet,

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

(OP)
bump

Any ideas...anyone?

RE: .VB Journal NX5

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

RE: .VB Journal NX5

(OP)
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?

RE: .VB Journal NX5

OK.  Try changing the line

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

to

ufs.ufobj.deleteobject(objs(i).tag)
 

RE: .VB Journal NX5

Scratch that last post.  Change

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

to

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

RE: .VB Journal NX5

(OP)
Seems to work great! Thanks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources