I took a question posted to the GTWiki today. Here is the question and response:
I am looking for one macro which will create datum plates to live planes ( Equation with referance axis system ) Can anybody help on this .
Excellent suggestion. There are a few ways you can attack this:
1.) Make a macro converts the datum geometry to live.
The unfortunate thing about this task is that datum conversion and replacement is not exposed to Digital Project/CATIA Visual Basic. You would only need to use this method if you have already used the plane system from which to model; i.e. if the planes or some of the planes are parents to other geometry in the file. I wrote an article on a hack that can do this conversion on points using the command SendKeys. This is buggy though, should not be used in practice, and may not work because it was written in R3. Nevertheless, it’s a good example of the type of VB hack scripting you’ll have to do in order to do a genuine conversion from datum to live.
2.) Make a macro that reads the location of the datum geometry and creates a new plane.
This technique is much simpler because it does not rely on buggy hacks to create. This technique would only work if you haven’t already modeled on top of your plane system; the planes cannot be parents. If you just ran a “new plane creator” on a model that has been parametrically linked, your original datum planes would still control the model. There is no automated way to “replace” datum planes with the newly created live planes. There is an interesting article on the GTWiki about making new points from the locations of datum points here. This would be a good place to begin if you wanted to learn how to make new geometry, just replace words like “HybridShapePointCoord” and “.addnewpointcoord(” with “HybridShapePlaneOffset” and “.addnewplaneoffset(” respectively. And your measuring would need to be different, but I’ll let you figure that out. 🙂
3.) Make a powercopy or UDF of a plane with parameter inputs.
It may seem like forever, but making a UDF and instantiating it several times can be quicker than investing the time to build a script. The general rule at GT is five-hundred; if the process has more than 500 objects or steps, it has the potential to be automated. If less, it is manually completed. Once you get into a groove, you can do hundreds of procedures quite quickly (using the double-click on a command or “repeat” on a powercopy instantiation.)
4.) Do a manual conversion of a datum plane into a live plane.
Sometimes the simplest answer is the best. If you only have a moderate number of planes, and you plan on converting them only once, you may want to consider doing a manual conversion. All datum geometry can be instantly made live, by double-clicking on the geometry. You will see the “Explicit” pull down on the Plane Dialog Box. Just change that to “Offset from Plane” or other live option. It will redeclare the object type into a usable plane, and will maintain any links that may be a child to this plane.
I hope this helps. Reply back if you have any questions about automation in VB (if you are just getting started in this department). I can go more in depth on either of those techniques mentioned above.