Gets the point at a specified angle and
distance from a given point.
Signature
VBA : RetVal = object.PolarPoint(Point, Angle, Distance)
VL : RetVal = (vla-PolarPoint
object Point Angle Distance)
(vla-polarpoint
util P3 0 lg)
- Object : Utility
The object or objects this method applies to.
- Point : Variant (three-element
array of doubles); input-only
The 3D WCS coordinates specifying the start point.
- Angle : Double; input-only
The angle in radians.
- Distance : Double; input-only
The distance in current units.
- RetVal : Variant (three-element
array of doubles)
The 3D WCS coordinates at the specified angle and distance from a
given point.
Example :
;CODING STARTS HERE
(defun c:slot ( / acaddoc util mspace ip lg
dia P1 P2 P3 P4 P5 P6 P7)
;load VL functions
(vl-load-com)
;obtain reference to the Active Document
(setq acaddoc (vla-get-activeDocument (vlax-get-acad-object)))
;obtain reference to Utilities
(setq util (vla-get-utility acaddoc))
;obtain reference to Model Space
(setq mspace (vla-get-modelSpace acaddoc))
;get the insertion point
(setq ip (vla-getpoint util nil "\nInsertion Point: "))
;get the length
(setq lg (vla-getreal util "\nEnter Slot Length: "))
;get the diameter
(setq dia (vla-getreal util "\nEnter Slot Diameter: "))
;calculate all the points
(setq P1 (vla-polarpoint util IP (dtr 270.0) (/ dia 2)))
(setq P2 (vla-polarpoint util P1 (dtr 180.0) (/ lg 2)))
(setq P3 (vla-polarpoint util P2 (dtr 90.0) dia))
(setq P4 (vla-polarpoint util P3 0 lg))
(setq P5 (vla-polarpoint util P4 (dtr 270.0) dia))
(setq P6 (vla-polarpoint util P2 (dtr 90.0) (/ dia 2)))
(setq P7 (vla-polarpoint util P5 (dtr 90.0) (/ dia 2)))
;draw the lines
(vla-AddLine mspace p2 p5)
(vla-AddLine mspace p3 p4)
;add the arcs
(vla-AddArc mspace p6 (/ dia 2) (dtr 90.0) (dtr 270.0))
(vla-AddArc mspace p7 (/ dia 2) (dtr 270.0) (dtr 90.0))
(princ)
);defun
----------
;convert degrees to radians
(defun DTR (a)
(* pi (/ a 180))
);defun
----------
(princ)
;CODING ENDS HERE
|
|