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 TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't see new reference set

Status
Not open for further replies.

Matt1849

Computer
Joined
Apr 23, 2014
Messages
3
Location
US
My goal is to create a new reference set for each model-part from a given component. The reference set is supposed to show line segments, ARC segments, and Spline segments. I am able to create a new reference set for each model-part, but now I am stuck on how to add the objects to the reference sets. I'm using addObjectsToReferenceSet(), and looking at the log shows that it has been added to the reference set. However, when I try to replace the reference set to the one I just created, the part shows up blank. I have also noticed this message:

Assembly Navigator: Deferred node update outside transactions is enabled

come up after I create a reference set, but I haven't been able to find out what it means. Is there a reason why I can't see the result of the new reference set, or is there a display method I'm missing?

Thanks for your time.
 
cowski, I am currently using NX 9. The code I have below checks to see if a given part has a segment, and if so populate that segment into the given reference set.

Java:
partList = getParts(compList, myComponent);
		ArrayList<ReferenceSet> newRefSet = new ArrayList<ReferenceSet>();

		for (int index = 0; index < partList.size(); index++) {
			// check to see if part has segments, and if so add it to the
			// correct reference set
			if (hasSegment(partList.get(index)) != true) {
				NXLogger.println("There is no segment");
			} else {
				NXLogger.println("There are segments!");
				newRefSet.add(createNewSynRefSet(partList.get(index)));

				/*
				 * Add the segments from a part to the new reference set. I was
				 * hoping that each part had it's own segments, but it appears
				 * they all are inside the component.
				 */
				for (int x = 0; x < newRefSet.size(); x++) {
					populateRefSet(partList.get(index), newRefSet.get(x));
				}
			}
		}


Java:
@SuppressWarnings("unchecked")
	private static void populateRefSet(Part compPart, ReferenceSet refSet)
			throws RemoteException, NXException {

		NXLogger.println("Entering populateRefSet()");

		/**************************************/
		/* add line segment objects to reference set */
		/**************************************/
		LineSegmentCollection lines = compPart.segmentManager().lineSegments();
	

		// get the iterator
		Iterator<LineSegment> lineIterator = lines.iterator();

		NXObject[] addLines = new NXObject[1];

		int segmentCount = 0;
		for (TaggedObjectCollection.Iterator ii = lines.iterator(); ii
				.hasNext();) {
			segmentCount++;
			ii.next();
			NXLogger.println("found line segment");
		}
		NXLogger.println("Number of line segments found: " + segmentCount);

		while (lineIterator.hasNext()) {
			LineSegment line = lineIterator.next();

			if (line.getIsSegmentInterior() == nxopen.routing.Interior.NOT_INTERIOR_TO_PART) {
				addLines[0] = line;
				line.setLayer(1);
				refSet.addObjectsToReferenceSet(addLines);
				NXLogger.println("add line segment under layer " + line.layer());
				
			} else {
				NXLogger.println("find a interior line");
			}
		}


Java:
private static boolean hasSegment(Part compPart) throws RemoteException,
			NXException {

		NXLogger.println("Entering hasSegment()");
		NXLogger.println("Using part: " + compPart.name());

		boolean found = false;
		int segmentCount = 0;

		/* check line segment */
		/*
		 * Within compPart, tell segmentManager to look for line segments and
		 * store it in a collection called lines
		 */
		LineSegmentCollection lines = compPart.segmentManager().lineSegments();

		for (TaggedObjectCollection.Iterator ii = lines.iterator(); ii
				.hasNext();) {
			segmentCount++;
			ii.next();
			NXLogger.println("found line segment");
		}
 
jerry1423, it appears that when I try to set a line segment to a layer, it will show up on the screen which is good news! However, when I try setting different segments to the same layer, they aren't displayed. Do you know what would be the proper layer settings for an arc or spline segment?
 
I'm not familiar with the routing module, so I have a basic question...

What part "owns" these routing objects (segments)? Are they created in the component part file and shown in the assembly or are they created in the assembly?

If they are created in the assembly file, they cannot be added to the component's reference set.

www.nxjournaling.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top