Showing results for 
Search instead for 
Did you mean: 

Handling large geometry in batch mode


I'm running into an issue when using Assembly Cut with a rather large Target body. 


If I do the cut manually in Display mode I can do it succesfully but not without having to increase the screensize rendering, otherwise I am unable to actually select the solidy body. 


I thought this wouldn't be an issue running this in batch but somehow it keeps saying that the target body is invalid despite it working in display.


I've tried adding the change in display mode to see if that works, but it doesn't seem to make an impact. Also if you do change these settings you need to 'restart' NX for it to take effect, so I doubt this would work anyway.

changeList1 = theSession.OptionsManager.NewOptionsChangeList(NXOpen.Options.LevelType.User, NXOpen.Options.LevelLockedByDefault.FalseValue)
changeList1.SetValue("UG_maxFitBoxSize_MU", 2650005)

this is where the assembly cut happens

def assyCut( workPart, body1, body2 ) :
	theSession  = NXOpen.Session.GetSession()
	assemblyCutBuilder1 = workPart.Features.CreateAssemblyCutBuilder(NXOpen.Features.AssemblyCut.Null)
	assemblyCutBuilder1.ContextComponent = NXOpen.Assemblies.Component.Null
	added1 = assemblyCutBuilder1.TargetBody.Add(body1)
	added2 = assemblyCutBuilder1.ToolBody.Add(body2)
	if assemblyCutBuilder1.Validate() == False:
			print(' Tried to use assembly cut but failed, EXITING NX\n')
	nXObject1 = assemblyCutBuilder1.Commit()
	return None

But alas, "Selection of target body is invalid"


Running it from tools>journals makes no difference. What am I missing here?


Re: Handling large geometry in batch mode


I tried to do this with two simpler much smaller parts and again, no problem doing the assembly cut myself but when doing it through journals the target body keeps being invalid. I also made a temporary save of the part just before it tries the assembly cut and checked to see if I could perform it myself on that part and no errors there either. 


Any tips?

Re: Handling large geometry in batch mode


I have found a solution, but I'm not sure why:


added1 = assemblyCutBuilder1.TargetBody.Add(body1)
added2 = assemblyCutBuilder1.ToolBody.Add(body2)
objects1 = [NXOpen.Body.Null] * 2 
objects1[0] = body1
objects1[1] = body2
removed1 = assemblyCutBuilder1.TargetBody.RemoveArray(objects1)
added1 = assemblyCutBuilder1.TargetBody.Add(body1)
added2 = assemblyCutBuilder1.ToolBody.Add(body2)

I had tried adding the RemoveArray before but it had no effect, then I copy-pasted the assignment of Target and Tool body and it worked. I didn't think it would because prior it crashed whenever it tried to assign the Toolbody, but now it works I suppose.