Jump to content

This lisp puts dimensions on a pline, how can I have it put the dimensions above the pline? Also it doesn't put a dimension on the last line.


Recommended Posts

Posted (edited)
(defun c:PLD (/ ent obj i p1 p2)
  (vl-load-com)
  (if (setq ent (car (entsel "\nSelect Polyline to Dimension: ")))
    (progn
      (setq obj (vlax-ename->vla-object ent))
      (if (= (vla-get-ObjectName obj) "AcDbPolyline")
        (progn
          (setvar "cmdecho" 0)
          (command "._undo" "_begin")
          (setq i 0)
          ;; Loop through vertices
          (repeat (fix (- (vlax-curve-getEndParam obj) 1))
            (setq p1 (vlax-curve-getPointAtParam obj i)
                  p2 (vlax-curve-getPointAtParam obj (1+ i)))
            ;; Create aligned dimension
            (command "_.dimaligned" "_none" p1 "_none" p2 "_none" (polar p1 (+ (angle p1 p2) (/ pi 2)) 1.0))
            (setq i (1+ i))
          )
          (command "._undo" "_end")
          (setvar "cmdecho" 1)
        )
        (princ "\nSelected object is not a LightWeight Polyline.")
      )
    )
  )
  (princ)
)
(princ "\nType 'DimPlineSegments' to run.")

 

Edited by SLW210
Added Code Tags!!
Posted

In the future please place your code in Code Tags. (<> in the editor toolbar)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...