I need help with creating WAVE link with NX Open. I thought it's going to be easier but it turned out a bit tougher...
Basically, I have an assembly called "Stack Container" (let's call it part A). It contains two components - "Stack Template" (part B) and "Deformation Template" (part C). I need to make in part C WAVE-copies of solid bodies from part B.
I began with obtaining bodies that exist in part B. Then I attempted to create WAVE-copies using those bodies as input. But I keep receiving the error message "NXOpen.NXException: The linked feature could not be created because the selected object is within the work part." I'm a bit stuck here. Evidently, my input is wrong and I can't use bodies obtained directly from part B. But what shall I use instead?
Here's the part of the code dealing with WAVE:
theSession.Parts.SetWork(deformationTemplatePRT); NXOpen.Features.WaveLinkBuilder waveLinkBuilder1 = workPart.BaseFeatures.CreateWaveLinkBuilder(null); waveLinkBuilder1.Type = NXOpen.Features.WaveLinkBuilder.Types.BodyLink; NXOpen.Features.ExtractFaceBuilder extractFaceBuilder1 = waveLinkBuilder1.ExtractFaceBuilder; extractFaceBuilder1.FaceOption = NXOpen.Features.ExtractFaceBuilder.FaceOptionType.FaceChain; extractFaceBuilder1.ParentPart = NXOpen.Features.ExtractFaceBuilder.ParentPartType.OtherPart; extractFaceBuilder1.HideOriginal = false; NXOpen.Assemblies.Component component1 = (NXOpen.Assemblies.Component)dispPart.ComponentAssembly.RootComponent.FindObject("COMPONENT Stack Template 1"); Body body1 = (Body)component1.FindObject("PROTO#.Bodies|THICKEN_SHEET(412)"); //Body body1 = conductorSolidsOrder["R"]; SelectObjectList selectObjectList1 = extractFaceBuilder1.BodyToExtract; selectObjectList1.Add(body1); NXOpen.Features.BodyFeature theLinkedBody = (NXOpen.Features.BodyFeature)waveLinkBuilder1.Commit(); waveLinkBuilder1.Destroy();
The following line is taken from Journal and if I use it, it works perfectly:
Body body1 = (Body)component1.FindObject("PROTO#.Bodies|THICKEN_SHEET(412)");
The following line gives body obtained from part B as an input for the WAVE link creation. If I use it instead of the first one, I receive error message.
Body body1 = conductorSolidsOrder["R"];
Definitely I am led a bit astray. Could you please help me?
Solved! Go to Solution.
If B and C are components of A, you can only wave link the occurence bodies of B and C in A. I dont think you can wave link bodies from B to C since in C, you cant see the bodies in B (unless B is a sub component of C).
Wave linking a body from "B" to "C" in this case is a valid operation. Since it does not work with your line of code:
Body body1 = conductorSolidsOrder["R"];
I'd suggest focusing on that. It may not contain the body that you think it does.
Also, you may have a stale reference to the work part. I see that you change the work part to "deformationTemplatePRT", but when you create the wave link builder, you use the "workPart" variable. Depending on how "workPart" was declared, it may not point to the current work part ("deformationTemplatePRT").
use the current work part to create the builder
theSession.Parts.SetWork(deformationTemplatePRT); NXOpen.Features.WaveLinkBuilder waveLinkBuilder1 = theSession.Parts.Work.BaseFeatures.CreateWaveLinkBuilder(null);
or, update the "workPart" reference before creating the builder
theSession.Parts.SetWork(deformationTemplatePRT); workPart = theSession.Parts.Work; NXOpen.Features.WaveLinkBuilder waveLinkBuilder1 = workPart.BaseFeatures.CreateWaveLinkBuilder(null);
I tried workPart suggestion, but with the same result. "NXOpen.NXException: The linked feature could not be created because the selected object is within the work part."
The problem is definitely with Body body1 = conductorSolidsOrder["R"]. It contains bodies that I collect directly from stackTemplate.PRT via foreach (Body bodyToParse in stackTemplatePRT.Bodies). Can it be that need occurrences instead of actual bodies?
"Can it be that need occurrences instead of actual bodies?"
I don't know the answer to that off the top of my head, but it is worth trying.
Sure as hell it worked! By the way, your suggestion about updating workpart reference was also worthy - I receive error if I comment it out. Thank you!