軸の周囲のリージョンを指定して、回転ソリッドを作成します。
サポートされているプラットフォーム: Windows のみ
VBA:
RetVal = object.AddRevolvedSolid(Profile, AxisPoint, AxisDir, Angle)
タイプ: Block、ModelSpace、PaperSpace
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: Region
外形線には、Region オブジェクトのみが使用できます。
アクセス: 入力のみ
タイプ: バリアント型(3 要素の倍精度浮動小数点数型配列)
回転軸の始点を指定する 3D WCS 座標。
アクセス: 入力のみ
タイプ: バリアント型(3 要素の倍精度浮動小数点数型配列)
回転軸の方向を指定する 3D ベクトル。
アクセス: 入力のみ
タイプ: 倍精度浮動小数点数型
回転角度をラジアンで表したもの。完全に 1 回転させる場合は 6.28 と入力します。
回転するリージョンは閉じていなければなりません。ブロック内に含まれるオブジェクトを回転させることはできません。回転できるのは、一度に 1 つのオブジェクトのみです。
正の回転方向は、右手の法則にしたがって決定されます。
VBA:
Sub Example_AddRevolvedSolid() ' This example creates a solid from a region ' rotated around an axis. ' The region is created from an arc and a line. Dim curves(0 To 1) As AcadEntity ' Define the arc Dim centerPoint(0 To 2) As Double Dim radius As Double Dim startAngle As Double Dim endAngle As Double centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0# radius = 2# startAngle = 0 endAngle = 3.141592 Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle) ' Define the line Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint) ' Create the region Dim regionObj As Variant regionObj = ThisDrawing.ModelSpace.AddRegion(curves) ZoomAll MsgBox "Revolve the region to create the solid.", , "AddRevolvedSolid Example" ' Define the rotation axis Dim axisPt(0 To 2) As Double Dim axisDir(0 To 2) As Double Dim angle As Double axisPt(0) = 7: axisPt(1) = 2.5: axisPt(2) = 0 axisDir(0) = 11: axisDir(1) = 1: axisDir(2) = 3 angle = 6.28 ' Create the solid Dim solidObj As Acad3DSolid Set solidObj = ThisDrawing.ModelSpace.AddRevolvedSolid(regionObj(0), axisPt, axisDir, angle) ZoomAll ' Change the viewing direction of the viewport Dim NewDirection(0 To 2) As Double NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1 ThisDrawing.ActiveViewport.direction = NewDirection ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport ZoomAll MsgBox "Solid created.", , "AddRevolvedSolid Example" End Sub
Visual LISP:
(vl-load-com) (defun c:Example_AddRevolvedSolid() ;; This example creates a solid from a region ;; rotated around an axis. ;; The region is created from an arc and a line. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq modelSpace (vla-get-ModelSpace doc)) ;; Define the arc (setq centerPoint (vlax-3d-point 5 3 0) radius 2 startAngle 0 endAngle 3.141592) (setq arc (vla-AddArc modelSpace centerPoint radius startAngle endAngle)) ;; Define the line (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc))) (setq curves (vlax-make-safearray vlax-vbObject '(0 . 1))) (vlax-safearray-put-element curves 0 arc) (vlax-safearray-put-element curves 1 line) ;; Create the region (setq regionObj (vla-AddRegion modelSpace curves)) (vla-ZoomAll acadObj) (alert "Revolve the region to create the solid.") ;; Define the rotation axis (setq rotAxisPt (vlax-3d-point 7 2.5 0) rotAxisDir (vlax-3d-point 11 1 3) rotAngle 6.28) ;; Create the solid (setq solidObj (vla-AddRevolvedSolid modelSpace (vlax-safearray-get-element (vlax-variant-value regionObj) 0) rotAxisPt rotAxisDir rotAngle)) ;; Change the viewing direction of the viewport (setq NewDirection (vlax-3d-point -1 -1 1)) (setq activeViewport (vla-get-ActiveViewport doc)) (vla-put-Direction activeViewport NewDirection) (vla-put-ActiveViewport doc activeViewport) (vla-ZoomAll acadObj) (alert "Solid created.") )