Jump to content

Two CAD models


---
 Share

Recommended Posts

I have a program with the model oriented one way for several measurements, then rotated
180 degrees for the last two measurements. How do I import a second model that is rotated
180 degrees, from the first, while keeping the first? I have a programmable stop to prompt
the operator to flip it.
Link to comment
Share on other sites

It is possibleto do this using PCM. It will require you to have the PCM option.

The following two functions will allow this..

clearCAD()
loadCADFile("path to model")

clearCAD() clears the current cad model from the program

loadCADFile() load a new model.

you can use something like follows to switch models ..

The first part should go in your presettings for the program.. and also in a text file in the program directory called inspection_post_load_pcm.txt - placing it in the pcm file makes sure it will run whenever the program loads so the program will always default to the 'starting' model.

	
	// find our current inspection directory
	planpath = getActualInspectionDir()
	
	// this assumes we have created a subdirectory within the program directory
	// called models to use as a place to store our different models
	// we append the directory name to the program directory we got from calypso
	modelpath = planpath + "\models\"
	
	// now create a couple of variable to point to our different models.
	leftmodel = modelpath + "leftModel.sat"
	rightmodel = modelpath + "rightModel.sat"
	
	// make sure the left model is loaded at program start
	// to make sure this actually happens before the user does anything 
	// also put it in inspection_post_load_pcm.txt
	clearCAD()
	loadCADFile(leftmodel)
The next bit goes whereever your model needs to switch..

	clearCAD()
	loadCADFile(rightmodel)
Finally put the following in your programs postsettings. This will swap back to the starting model..

	clearCAD()
	loadCADFile(leftmodel)

I have not tested this exact code but it should be pretty close.. I use something simliar to this to swap models based on what mini-plan is chosen.

I should have also stated.. this will require you to create the models subdirectory and place your two different models there prior to running.
Link to comment
Share on other sites

Yeah, without PCM I don't think there's a way to update the models at runtime. Personally, I would only use the second model for feature definition and such, leaving it hidden in the CAD hierarchy normally.
Link to comment
Share on other sites

 Share

×
×
  • Create New...