Author Topic: Dimension angles of lines  (Read 2033 times)

0 Members and 1 Guest are viewing this topic.

Ron Heigh

  • Guest
Dimension angles of lines
« on: September 25, 2004, 12:25:45 PM »
I have a bunch of lines polar arrayed about the same point.
I need to add a text to the end of each line that states its degrees.
The text needs to be aligned to the lines angle.

Is there an existing routine to do this?

hendie

  • Guest
Dimension angles of lines
« Reply #1 on: September 25, 2004, 02:25:11 PM »
Ron, ther'e's an AMT (Align Move Text) on the RCI downloads page. It will align text with a selected line but not the polar array part, but it may save you some time

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Dimension angles of lines
« Reply #2 on: September 25, 2004, 02:25:48 PM »
Here's a sample for you. This function requires a line to be passed to as an argument and will perform a polar array, creating lines at 30 degree increments for a full circle. Then it labels each line with the degrees. Modify and adpt to your specific use as desried. The routine assumes that the object passed is either a Ename or Vla-object, that it is a line, and that *doc* has been previously set as a global variable of:
(vla-get-activedocument (vlax-get-acad-object))

Code: [Select]

(defun polar_label (lin)
  (if (or (eq (type lin) 'VLA-OBJECT)
 (and (eq (type lin) 'ENAME)
      (setq lin (vlax-ename->vla-object lin))
      )
 )
    (progn
      (setq polar_lines (append (vlax-invoke lin "arraypolar" 12 (* 2 pi) (vlax-get lin "startpoint")) (list lin))
   hgt (if (= 0.0 (vla-get-height (vla-get-activetextstyle *doc*)))
 (vlax-invoke *doc* "getvariable" "textsize")
 (vla-get-height (vla-get-activetextstyle *doc*))
 )
   )
      (mapcar '(lambda (x / txt)
(setq rot (vlax-get x "angle")
      insPt (vlax-get x "endpoint"))
(setq txt (vlax-invoke (vla-get-modelspace *doc*) "addtext" (angtos rot 1 4) insPt hgt))
(vlax-put txt "rotation" rot)
(vlax-put txt "alignment" acAlignmentMiddleLeft)
(vlax-put txt "textalignmentpoint" inspt)
)
     polar_lines)
      )
    )
  )