RevolutionAngle 属性 (ActiveX)
指定旋转角度。 支持的平台:仅限 Windows 属性值只读:
类型:ACAD_ANGLE 旋转曲面的旋转角度。 言论没有其他评论。 例子VBA: Sub SurfaceProperties() Dim ssetObj As AcadSelectionSet Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2") Dim mode As Integer AppActivate ThisDrawing.Application.Caption ssetObj.SelectOnScreen Dim obj As AcadEntity Dim extrude As AcadExtrudedSurface Dim objName As String Dim LayerName As String For Each obj In ssetObj objName = obj.ObjectName If TypeOf obj Is AcadExtrudedSurface Then ExtrudedSurfaceProperties obj ElseIf TypeOf obj Is AcadRevolvedSurface Then RevolvedSurfaceProperties obj ElseIf TypeOf obj Is AcadLoftedSurface Then LoftedSurfaceProperties obj ElseIf TypeOf obj Is AcadSweptSurface Then SweptSurfaceProperties obj ElseIf TypeOf obj Is AcadPlaneSurface Then PlaneSurfaceProperties obj End If Next ssetObj.Delete End Sub Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface) AppActivate ThisDrawing.Application.Caption GetSurfaceBoundingBox extrude MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _ "Height: " & extrude.height & vbCr & _ "TaperAngle: " & extrude.TaperAngle & vbCr & _ "Direction: " & extrude.Direction & vbCr & _ "Material: " & extrude.Material & vbCr & _ "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _ "VIsolineDensity: " & extrude.VIsolineDensity 'Now change the configurable properties extrude.height = extrude.height * 1.5 extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2) extrude.UIsolineDensity = extrude.UIsolineDensity * 2# extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5 ThisDrawing.Regen acActiveViewport Utility.GetString 0, "Press return to continue..." 'Now change the properties back to their original values extrude.height = extrude.height / 1.5 extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2) extrude.UIsolineDensity = extrude.UIsolineDensity / 2# extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5 End Sub Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface) AppActivate ThisDrawing.Application.Caption GetSurfaceBoundingBox revolve MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _ "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _ "AxisPosition: " & revolve.AxisPosition & vbCr & _ "AxisDirection: " & revolve.AxisDirection & vbCr & _ "Material: " & revolve.Material & vbCr & _ "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _ "VIsolineDensity: " & revolve.VIsolineDensity 'Now change the configurable properties revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2) revolve.UIsolineDensity = revolve.UIsolineDensity * 2# revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5 ThisDrawing.Regen acActiveViewport Utility.GetString 0, "Press return to continue..." 'Now change the properties back to their original values revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2) revolve.UIsolineDensity = revolve.UIsolineDensity / 2# revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5 End Sub Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface) AppActivate ThisDrawing.Application.Caption GetSurfaceBoundingBox lofted MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _ "NumCrossSections: " & lofted.NumCrossSections & vbCr & _ "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _ "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _ "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _ "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _ "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _ "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _ "Closed: " & lofted.Closed & vbCr & _ "Material: " & lofted.Material & vbCr & _ "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _ "VIsolineDensity: " & lofted.VIsolineDensity 'Now change the configurable properties lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2) lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4) lofted.UIsolineDensity = lofted.UIsolineDensity * 2# lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5 ThisDrawing.Regen acActiveViewport Utility.GetString 0, "Press return to continue..." 'Now change the properties back to their original values lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2) lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4) lofted.UIsolineDensity = lofted.UIsolineDensity / 2# lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5 End Sub Private Sub SweptSurfaceProperties(swept As AcadSweptSurface) AppActivate ThisDrawing.Application.Caption GetSurfaceBoundingBox swept MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _ "ProfileRotation: " & swept.ProfileRotation & vbCr & _ "Bank: " & swept.Bank & vbCr & _ "Twist: " & swept.Twist & vbCr & _ "scale: " & swept.scale & vbCr & _ "Length: " & swept.length & vbCr & _ "Material: " & swept.Material & vbCr & _ "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _ "VIsolineDensity: " & swept.VIsolineDensity swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25 swept.Bank = Not swept.Bank swept.Twist = swept.Twist * 3.14 * -0.5 swept.UIsolineDensity = swept.UIsolineDensity * 2# swept.VIsolineDensity = swept.VIsolineDensity * 0.5 ThisDrawing.Regen acActiveViewport Utility.GetString 0, "Press return to continue..." 'Now change the properties back to their original values swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25) swept.Bank = Not swept.Bank swept.Twist = swept.Twist / (3.14 * -0.5) swept.UIsolineDensity = swept.UIsolineDensity / 2# swept.VIsolineDensity = swept.VIsolineDensity / 0.5 End Sub Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface) AppActivate ThisDrawing.Application.Caption GetSurfaceBoundingBox planar MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _ "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _ "VIsolineDensity: " & planar.VIsolineDensity planar.UIsolineDensity = planar.UIsolineDensity * 2# planar.VIsolineDensity = planar.VIsolineDensity * 0.5 ThisDrawing.Regen acActiveViewport Utility.GetString 0, "Press return to continue..." 'Now change the properties back to their original values planar.UIsolineDensity = planar.UIsolineDensity / 2# planar.VIsolineDensity = planar.VIsolineDensity / 0.5 End Sub Private Sub GetSurfaceBoundingBox(surf As AcadSurface) Dim MinPoint As Variant Dim MaxPoint As Variant surf.GetBoundingBox MinPoint, MaxPoint ' Print the min and max extents MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _ & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _ & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface" End Sub 可视化 LISP: (vl-load-com) (defun c:SurfaceProperties() (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2")) (vla-SelectOnScreen ssetObj) (vlax-for obj ssetObj (setq objName (vla-get-ObjectName obj)) (cond ((= "AcDb3dSolid" objName) (cond ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected.")) ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected.")) ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected.")) ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected.")) ) ) ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj)) ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj)) ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj)) ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj)) ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj)) ) ) (vla-Delete ssetObj) ) (defun ExtrudedSurfaceProperties (extrude / ) (GetSurfaceBoundingBox extrude) (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude) "\nHeight: " (rtos (vla-get-Height extrude) 2) "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2) "\nMaterial: " (vla-get-Material extrude) "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude)) "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude)))) ;; Now change the configurable properties (vla-put-Height extrude (* (vla-get-Height extrude) 1.5)) (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2))) (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2)) (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5)) (vla-Regen doc acActiveViewport) (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...") ;; Now change the properties back to their original values (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5)) (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2))) (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2)) (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5)) ) (defun RevolvedSurfaceProperties (revolve / ) (GetSurfaceBoundingBox revolve) (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve) "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2) "\nMaterial: " (vla-get-Material revolve) "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve)) "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve)))) ;; Now change the configurable properties (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2))) (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2)) (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5)) (vla-Regen doc acActiveViewport) (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...") ;; Now change the properties back to their original values (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2))) (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2)) (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5)) ) (defun LoftedSurfaceProperties (lofted / ) (GetSurfaceBoundingBox lofted) (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted) "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted)) "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted)) "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted)) "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2) "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2) "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2) "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2) "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False") "\nMaterial: " (vla-get-Material lofted) "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted)) "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted)))) ;; Now change the configurable properties (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2))) (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4))) (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2)) (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5)) (vla-Regen doc acActiveViewport) (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...") ;; Now change the properties back to their original values (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2))) (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4))) (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2)) (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5)) ) (defun SweptSurfaceProperties (swept / ) (GetSurfaceBoundingBox swept) (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept) "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2) "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False") "\nTwist: " (rtos (vla-get-Twist swept) 2) "\nscale: " (rtos (vla-get-Scale swept) 2) "\nLength: " (rtos (vla-get-Length swept) 2) "\nMaterial: " (vla-get-Material swept) "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept)) "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept)))) (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25))) (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true)) (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5))) (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2)) (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5)) (vla-Regen doc acActiveViewport) (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...") ;; Now change the properties back to their original values (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25))) (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true)) (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5))) (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2)) (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5)) ) (defun PlaneSurfaceProperties (planar / ) (GetSurfaceBoundingBox planar) (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar) "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar)) "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar)))) (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2)) (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5)) (vla-Regen doc acActiveViewport) (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...") ;; Now change the properties back to their original values (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2)) (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5)) ) (defun GetSurfaceBoundingBox (surf / ) (vla-GetBoundingBox surf 'MinPoint 'MaxPoint) ;; Print the min and max extents (alert (strcat "The extents of the bounding box for the surface are:" "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) "," (rtos (vlax-safearray-get-element MinPoint 1) 2) "," (rtos (vlax-safearray-get-element MinPoint 2) 2) "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) "," (rtos (vlax-safearray-get-element MaxPoint 1) 2) "," (rtos (vlax-safearray-get-element MaxPoint 2) 2))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 12:43
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.