只有实体位置,大小,变化才有变换矩阵的操作, 你创建实体不涉及矩阵操作。
正方形你一样可以拉伸成立方体啊,你试试命令行用 extrude 命令,拉个矩形看看。封闭的曲线都行,下面图示拉的矩形和SPLINE
你分两步骤:
1、曲线变REGION
AcDbRegion::createFromCurves Function
static Acad::ErrorStatus createFromCurves( const AcDbVoidPtrArray& curveSegments, AcDbVoidPtrArray& regions); curveSegments | Input array of pointers to curve entities used to define the region's perimeter(s) | regions | Returns containing pointers to the AcDbRegion objects created | This static member function creates a set of AcDbRegion objects from the closed loops represented by the curves contained in the curveSegments array. The newly created region objects are returned in the regions array.
The curveSegments array must contain only pointers to AcDbLine, AcDbArc, AcDbEllipse, AcDbCircle, AcDbSpline, AcDb3dPolyline, or AcDbPolyline objects.
Note The objects in curveSegments must be opened for read and not for write. If the objects are opened, calling this function will crash AutoCAD.
Note It is the calling application's responsibility to either add the AcDbRegion objects returned in the regions array to an AcDbDatabase or to delete them when they are no longer needed.
Returns Acad::eOk if the function is completely successful.
If there is any problem during the creation of an AcDbRegion from any of the curves in curveSegments, then this function returns Acad::eInvalidInput and the regions array contains pointers to any AcDbRegion objects that were created before the error occurred. So, do not assume that a non-Acad::eOk return status indicates a total failure with no dynamically-allocated AcDbRegion objects returned.
2、REGION拉伸成3DSOLID
AcDb3dSolid::extrude Function
virtual Acad::ErrorStatus extrude( const AcDbRegion* region, double height, double taperAngle = 0.0); region | Input pointer to a region object | height | Input height for extrusion | taperAngle | Input taper angle in radians | Creates a solid by extruding pRegion, a distance of height with a taper angle of taper. The extrusion direction is along the normal of the region if the height is positive. taper should be between half pi and -half pi. If the absolute value of taper < 1e-6, then the taper angle is set to 0.
If taper is nonzero, the region should only have lines, circles, and circular arcs that join together smoothly (equal tangents at the points of connection).
The region should not have self-intersections. Any self-intersections caused by the sweep will not be corrected.
For more information, see the EXTRUDE command in the AutoCAD Command Reference.
Returns Acad::eOk if this method succeeds.
If height <= 1e-6 or abs(taper) >= (PI/2) - (1e-6), then Acad::eOutOfRange will be returned.
If region == NULL or the region has no ShapeManager object, then Acad::eInvalidInput is returned.
If the ShapeManager object creation fails, then Acad::eGeneralModelingFailure will be returned.
|