Jump to content

Recommended Posts

Posted

Hello,

I am using Civil 3d 2008 and i am looking for a way to "dimension" a polyline between specific vertexes.

For example if i have a polyline with 50 vertexes and i need to write the length between vertex 1 to 5, then 5 to 12, then 12 to 24 etc. I don't need the dimensions between every vertex but the length of the polyline from vertex i give to another vertex i give. This length must be writen above (in the middle) the measured length. Until now i was doing it manually. Break the polyline==> list==> add text with the length. But it takes to much time to do that. Is there any way to do that quicker?

Thanks to you all,

George.

Posted

This will label them all - you can remove the ones you don't want:

 

(defun c:LabelSegs ( / *error* spc doc ent flg )
 (vl-load-com)
 ;; Lee Mac  ~  18.05.10

 (defun *error* ( msg )
   (and flg (vla-EndUndomark doc))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))    

 (setq spc
   (if
     (or
       (eq AcModelSpace
         (vla-get-ActiveSpace
           (setq doc
             (vla-get-ActiveDocument
               (vlax-get-acad-object)
             )
           )
         )
       )
       (eq :vlax-true (vla-get-MSpace doc))
     )
     (vla-get-ModelSpace doc)
     (vla-get-PaperSpace doc)
   )
 )  

 (if
   (setq ent
     (CurveifFoo
       (lambda ( x )
         (eq "LWPOLYLINE"
           (cdr (assoc 0 (entget x)))
         )
       )
       "\nSelect LWPolyline to Label: "
     )
   )
   (
     (lambda ( n / der )
       (setq flg (not (vla-StartUndoMark doc)))        
       (repeat (fix (vlax-curve-getEndParam ent))
         (vla-put-rotation
           (AddText spc
             (rtos
               (-
                 (vlax-curve-getDistatParam ent (setq n (1+ n)))
                 (vlax-curve-getDistatParam ent (1- n))
               )
             )
             (polar
               (vlax-curve-getPointatParam ent (- n 0.5))
               (+
                 (setq der
                   (angle '(0. 0. 0.)                
                     (vlax-curve-getFirstDeriv ent (- n 0.5))
                   )
                 )
                 (/ pi 2.)
               )
               (/ (getvar 'TEXTSIZE) 2.)
             )
             (getvar 'TEXTSIZE)
           )
           (MakeReadable der)
         )
       )
       (setq flg (vla-EndUndomark doc))
     )
     (vlax-curve-getStartParam ent)
   )
 )
 (princ)
)

(defun MakeReadable ( a )
 (cond
   (
     (and (> a (/ pi 2)) (<= a pi))

     (- a pi)
   )
   (
     (and (> a pi) (<= a (/ (* 3 pi) 2)))

     (+ a pi)
   )
   (
     a
   )
 )
)

(defun AddText ( block str point height / o )
 (vla-put-Alignment
   (setq o
     (vla-AddText block str
       (vlax-3D-point point) height
     )
   )
   acAlignmentMiddleCenter
 )
 (vla-put-TextAlignmentPoint o (vlax-3D-point point))
 o
)

(defun CurveifFoo ( foo str / sel ent )
 (while
   (progn
     (setq sel (entsel str))
     
     (cond
       (
         (vl-consp sel)

         (if (not (foo (setq ent (car sel))))
           (princ "\n** Invalid Object Selected **")
         )
       )
     )
   )
 )
 ent
)

Posted

Lee Mac and Alanjt, thanks for your quick responce. Unfortunately those lisps doesn't work for what i need to do. Maybe i didn't make my self very clear (my english are not so good). I attach a foto to make it more clear. Let's suppose i have the red lwpoline, and the points A,B,C,D. What i need to do is write the length of the polyline between the points A and B (101.70m), B-C (91.35m), C-D (151.42m), D-A (77.86m), not the "dimaligned" between the vertexes. I hope you can help me.

George.

example.jpg

Posted

Alanjt, thank you very much for your help. That will save me much time.

Is it posible the distance between the two points to be writen above the polyline and in the middle of the points?

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...