Jump to content

Field displaying total length of multiple polylines


a482

Recommended Posts

Hi,

 

I am looking to find a way to show a field which shows the total length of different colour polylines and automatically updates as I add or remove those lines.

 

For example the field would be based on displaying the total length of all polylines that are colour 10 in the drawing. 

Another field doing the same for colour 30 etc.

 

This would help with costing once the full design as been done. 

 

Ideally I would add field at the end of each legend below to show the total length of each line in the drawing.

 

Thanks,

 

image.png.88592cee51736ddeeeae503bd780e27b.png

Link to comment
Share on other sites

On 10/22/2019 at 6:30 AM, BIGAL said:

Field

 

FYI

SPLINE not supported

distance in 3D

 

(defun c:test (/ l s p)

  (and (setq s (ssget '((0 . "*LINE")))) ;SPLINE not supported! 
       (setq l (ACET-SS-TO-LIST s))
       (setq p (getpoint "\nSpecify point.. "))
       (entmakex
         (mapcar 'cons
                 '(0 40 10 1)
                 (list "TEXT"
                       (getvar 'textsize)
                       p
                       (apply 'strcat
                              (append (cons "%<\\AcExpr ("
                                            (mapcar ''((x / vo )
                                                       (strcat
                                                        "%<\\AcObjProp Object(%<\\_ObjId "
                                                        (itoa (vla-get-ObjectID (setq vo (vlax-ename->vla-object x))))
                                                        ">%)."(if (vlax-property-available-p vo 'arclength)"arc" "")
                                                        "length>%+"
                                                        )
                                                       )
                                                    l
                                                    )
                                            )
                                      '("0.0) \\f %lu2%pr3>%")
                                      )
                              )
                       )
                 )
         )
       )
  (vl-cmdf "_.regen")
  (princ)
  )

sorry ET loop

 

credits: field expression which strcat "+0.0" (plus zero) simple idea was inspired by @Stefan BMR

 

Link to comment
Share on other sites

Nice one 

 

Maybe do a few more as part of a single defun that returns length, Circle 'circumference &  Arc 'arclength of object.

 

Could use the multiple toggles to choose normal items plus say layer or layers. Allow user pick

(if (not AH:Toggs)(load "Multiple toggles.lsp"))
(setq ans (ah:toggs '("Please Choose" " Lines" " LwPlines" " Arcs" " Circles" " Layer single" " Layers multiple" )))

 

 

image.png.bfa18d4100bbd9d6e2708aa97ed76ccb.png

Link to comment
Share on other sites

  • 6 months later...

Hi BIGAL - I am interested in the VBA version of this routine. I am looking to have a form where the user can select polylines from the drawing and the total length of the polylines is displayed on the form. Is there any source code for the VBA version shown above?

 

Thanks

Link to comment
Share on other sites

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