a482 Posted October 17, 2019 Posted October 17, 2019 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, Quote
BIGAL Posted October 17, 2019 Posted October 17, 2019 Found this explains how to add fields together, step 2, to give total. Next step would be to use a selection and create automatically. Hint is lee-mac has some good stuff like objid for field. https://cadprotips.com/2018/01/28/fields-to-calculate-areas-in-autocad-part-2/ Quote
Aftertouch Posted October 21, 2019 Posted October 21, 2019 To auto-update for new lines, you'll have to create a Reactor in some sort. Quote
BIGAL Posted October 21, 2019 Posted October 21, 2019 Aftertouch that's why you use Fields have a look at the link. Quote
hanhphuc Posted October 23, 2019 Posted October 23, 2019 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 Quote
BIGAL Posted October 23, 2019 Posted October 23, 2019 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" ))) Quote
BCConnor Posted May 18, 2020 Posted May 18, 2020 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 Quote
BIGAL Posted May 19, 2020 Posted May 19, 2020 Its part of a bigger program and I don't play a lot with VBA hopefully this is what you need. multi-vba.txt frmMulti.frm frmMulti.frx Quote
Recommended Posts
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.