Cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean operation without switching work part

Creator
Creator

Hi,

I‘ve had a interesting problem recently.

 

There are 2 bodies belonging to different part that need to do boolean operation. And those 2 parts are not work part or display part. And the entrie assembly is a complex automobile injection mould, switching work part will take a LONG time.

 

So, i try to perform the boolean operation without switching work part:

 

First, i use ufs.Wave.CreateLinkedBody to lined a body into another part. it's ok.

Then the error messge show that boolean operation can only performed in work part.

I have tried ufun and NXOpen, it's all failed.

 

thanks in advance

 

 

1 REPLY 1

Re: Boolean operation without switching work part

Creator
Creator

By the way, if you want to copy objects into non-work part. The NXOpen api "Part.BaseFeatures.CreateWaveLinkBuilder" may not work. It can only performed in work part too.

 

Fortunately, the ufun work~ share a piece of my code:

public static List<Body> WaveBodies(this Part targetPart, Component targetComponent,
            List<Body> sourceBodies, Component sourceComponent)
        {
            var results = new List<Body>();

            var ufs = UFSession.GetUFSession();
            
            Tag xform;
            ufs.So.CreateXformAssyCtxt(targetPart.Tag, sourceComponent.Tag, targetComponent.Tag, out xform);

            foreach (var occ in sourceBodies)
            {
                var protoTypeBody = occ.IsOccurrence ? occ.Prototype as Body : occ;

                if (protoTypeBody == null)
                    continue;
                if (protoTypeBody.GetSuppress() == 1) // if body's feature are all suppressed, skip
                    continue;

                var layer = protoTypeBody.Layer;

                Tag linkedFeature;
                ufs.Wave.CreateLinkedBody(protoTypeBody.Tag, xform, targetPart.Tag, true, out linkedFeature);
                ufs.Modl.Update();

                var result = NXObjectManager.Get(linkedFeature);
                var extractFace = result as ExtractFace;
                var b = extractFace?.GetBodies();

                if (b == null)
                    continue;

                results.AddRange(b);
                foreach (var body in b)
                {
                    body.Layer = layer;
                }
            }
            
            return results;
        }