Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

How to add an item from Reuse Library to work part through VB journal?

Status
Not open for further replies.

hppianoman

Mechanical
Mar 8, 2012
7
Good afternoon!

I am using NX7.5, and am trying to write a vb journal that does the following:
1. Loop through all geometry in the work part looking for arcs.
2. Find only the arcs with a diameter of .380 or .385
3. Place a part/sketch from the reuse library at the centerpoint of these arcs on the same plane as the arcs.
4. Delete the .380 and .385 diameter arcs that were used for placing the reuse item.
5. Change all of the parts/sketches that were just placed to layer 1.

I am able to loop through the geometry and find the arcs that I am looking for with the .380 or .385 diameters. I am only working with the Flat-pattern of a model, so only the XY plane is used. I can also change the Reuse items to layer 1 after they have been placed on the work part, but I am having trouble pulling the reuse item out and placing it at the centerpoints of the arcs with the program.

When I recorded my steps into a journal, the code had the lines:
Dim part1 As Part = CType(theSession.Parts.FindObject(“@DB/002208/000”), Part)
Dim Sketch1 as Sketch = CType(part1.Sketches.FindObject(“SKETCH_000”), Sketch)

When I opened up the object I want to use out of the Reuse Library, the part was named 002208 with a revision of 000 like in the first line. When I drag the item out of the Reuse Library onto the part, it is named SKETCH_000 like in the second line. The journal then uses sketchPasteBuilder some way. I’m not really sure how to use the sketchPasteBuilder, and didn’t understand what all it was doing.

Can anyone help with explaining this or setting it up for me? Is there a better way of doing this? Any help would be appreciated. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor