How to change orientation of sketch in CATIA using VB/Knowledgeware?

1k Views Asked by At

I am trying to create a knowledge template, such that when I choose a string value from a dropdown list of a multiple value parameter, the reaction fires according to the selection. For example, if I select "no cut", no pocket features are created. (or deleted if they already exist) If I select "top cut", a predefined sketch is used to drive the pocket feature. However, where I'm stuck, is that I want to define a "bottom cut" by changing the orientation of a positioned sketch. I envision it like this:

  1. "bottom cut" selected from drop down list
  2. change sketch support would be initiated
  3. "Reverse V" would be selected
  4. sketch would be flipped around the xy plane
  5. If "both top and bottom cut" is selected, it would return the sketch to top position (uncheck "Reverse V") and mirror the resultant pocket around XY

I have managed to accomplish everything but the "Reverse V" of "Change Sketch Support". No idea at all what is the best way to accomplish this.
So far, I've created both Knowledgeware actions, and VB actions. Open to any and all suggestions on this one.

Thank you.

1

There are 1 best solutions below

1
On

Regarding that API for flipping objects orientation are not available, I suggest that you base your sketch orientation on a feature that can be easily flipped:

  • Create a line based on two "coordinates" points
  • Use positioned sketch and specify the support plane, the origin point, and orientation for the V direction by using the previously created line
  • You can now control the points coordinates to change the orientation of the line, and the sketch will follow.

The code will be simple, and the solution is very stable.

Assuming that the reference line is based on two points {0,0,0} and {x,0,0}, the code would be

if TopOrientation
{
    GeoSet1\RefPoint\X=1mm
}
else
{
    GeoSet1\RefPoint\X=-1mm
}

I hope it will help you.