Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.
I am using ProSectionLocationGetto get the transformation from 2D to 3D for a cosmetic sketch in a sheet metal flat state instance. The function is returning the transformation for the section orientation as it sits in the folded model and not the flat instance. Does anyone know what I need to do to get the transformation for the section in the flat state instance ?
Here is a method that gives the general idea of what I am attempting:
This routine will attempt to generate a normal for the passed in section (sketch) as if it were a
surface. It will be used to determine if the cosmetic geometry on the sketch should be output to the
DXF. A sketch is not a surface but I am generating a normal as if it were so that I can decide if the
sketch faces the proper direction in order to be output to the DXF.
A call to GetSection must be made first to populate the member var called objSection.
ProError trnProSection::GetSurfaceNormalForTheSketch(ProVector SurfaceNormal)
{
ProMatrix tstmatrix;
Pro3dPnt SketchOrigin = {0,0,0};
Pro3dPnt XaxisPoint = {1,0,0};
Pro3dPnt YaxisPoint = {0,1,0};
Pro3dPnt Zaxis;
Get the Matrix that will allow us to Xform the 2D sketch geom to 3D part space
LastProeError = ProSectionLocationGet(objSection, matrix);
LastProeError = ProSectionLocationGet(objSection, mtxSectionLocationMatrix);
ProUtilMatrixInvert(tstmatrix,matrix);
if (LastProeError != PRO_TK_NO_ERROR)
return (LastProeError);
myLine = new ProLinedata;
Xform the 2D sketch geom to 3D part space
LastProeError = ProPntTrfEval(SketchOrigin, mtxSectionLocationMatrix, SketchOrigin);
if (LastProeError != PRO_TK_NO_ERROR)return (LastProeError);
LastProeError = ProPntTrfEval(XaxisPoint, mtxSectionLocationMatrix, XaxisPoint);
if (LastProeError != PRO_TK_NO_ERROR)return (LastProeError);
LastProeError = ProPntTrfEval(YaxisPoint, mtxSectionLocationMatrix,YaxisPoint);
if (LastProeError != PRO_TK_NO_ERROR)
return (LastProeError);
Translate the axis points to the 3D part origin
XaxisPoint[0] = XaxisPoint[0] - SketchOrigin[0];
XaxisPoint[1] = XaxisPoint[1] - SketchOrigin[1];
XaxisPoint[2] = XaxisPoint[2] - SketchOrigin[2];
YaxisPoint[0] = YaxisPoint[0] - SketchOrigin[0];
YaxisPoint[1] = YaxisPoint[1] - SketchOrigin[1];
YaxisPoint[2] = YaxisPoint[2] - SketchOrigin[2];
Now perform a cross product to get a vector perpendicular
ProUtilVectorCross(XaxisPoint,YaxisPoint,Zaxis);
Now normalize the vector
ProUtilVectorNormalize(Zaxis,SurfaceNormal);
return (LastProeError);
}
Hello all,
Joe,
I would get the parent surface of the sketch using ProElemtReferenceGet or ProElementReferencesGet. From the parent surface get an unfolded surface using ProSmtBendsrfParentGet, construct transformation matrix for the unfolded surface. Then you will need to construct the rotationaltransformation from your section matrix to theunfolded surfacematrix and apply the transformation to your normal vector.
HIH.
FV.
In Reply to Joe Wheatley:
I am using ProSectionLocationGetto get the transformation from 2D to 3D for a cosmetic sketch in a sheet metal flat state instance. The function is returning the transformation for the section orientation as it sits in the folded model and not the flat instance. Does anyone know what I need to do to get the transformation for the section in the flat state instance ?Here is a method that gives the general idea of what I am attempting:
This routine will attempt to generate a normal for the passed in section (sketch) as if it were a
surface. It will be used to determine if the cosmetic geometry on the sketch should be output to the
DXF. A sketch is not a surface but I am generating a normal as if it were so that I can decide if the
sketch faces the proper direction in order to be output to the DXF.
A call to GetSection must be made first to populate the member var called objSection.
ProError trnProSection::GetSurfaceNormalForTheSketch(ProVector SurfaceNormal)
{
ProMatrix tstmatrix;Pro3dPnt SketchOrigin = {0,0,0};
Pro3dPnt XaxisPoint = {1,0,0};
Pro3dPnt YaxisPoint = {0,1,0};
Pro3dPnt Zaxis;
Get the Matrix that will allow us to Xform the 2D sketch geom to 3D part spaceLastProeError = ProSectionLocationGet(objSection, matrix);LastProeError = ProSectionLocationGet(objSection, mtxSectionLocationMatrix);
ProUtilMatrixInvert(tstmatrix,matrix);if (LastProeError != PRO_TK_NO_ERROR) return (LastProeError);myLine = new ProLinedata;Xform the 2D sketch geom to 3D part spaceLastProeError = ProPntTrfEval(SketchOrigin, mtxSectionLocationMatrix, SketchOrigin);
if (LastProeError != PRO_TK_NO_ERROR)return (LastProeError);LastProeError = ProPntTrfEval(XaxisPoint, mtxSectionLocationMatrix, XaxisPoint);
if (LastProeError != PRO_TK_NO_ERROR)return (LastProeError);LastProeError = ProPntTrfEval(YaxisPoint, mtxSectionLocationMatrix,YaxisPoint);
if (LastProeError != PRO_TK_NO_ERROR)return (LastProeError); Translate the axis points to the 3D part originXaxisPoint[0] = XaxisPoint[0] - SketchOrigin[0];
XaxisPoint[1] = XaxisPoint[1] - SketchOrigin[1];
XaxisPoint[2] = XaxisPoint[2] - SketchOrigin[2];
YaxisPoint[0] = YaxisPoint[0] - SketchOrigin[0];
YaxisPoint[1] = YaxisPoint[1] - SketchOrigin[1];
YaxisPoint[2] = YaxisPoint[2] - SketchOrigin[2];
Now perform a cross product to get a vector perpendicularProUtilVectorCross(XaxisPoint,YaxisPoint,Zaxis);
Now normalize the vectorProUtilVectorNormalize(Zaxis,SurfaceNormal);
return (LastProeError);}