Jump to content

Get total length of selected lines and change them in to red color


Recommended Posts

Posted

Sir,

 

Could you please provide me full lisp of the followings

 

"get the total length of the selected lines which i selected in the screen, and change the selected line's colors in to red "

 

please display the total length in the command window so that i can copy as a text :)

 

 

Regards

Siyad

Posted

Hi,

 

Give this a try and let me know.

(defun c:Test ( / num sel int ent )
 ;;	Tharwat - Date: 19.07.2017	;;
 (princ "\nSelect lines,Polylines to get lengths then to move to Red color :")
 (if (setq num 0. sel (ssget "_:L" '((0 . "LINE,LWPOLYLINE"))))
   (repeat (setq int (sslength sel))
     (setq ent (ssname sel (setq int (1- int)))
           num (+ num (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)))
           )
     (entmod (append (entget ent) '((62 . 1))))
     )
   )
 (and (< 0.0 num) (princ (strcat "\nTotal lengths: " (rtos num 2 4))))
 (princ)
 ) (vl-load-com)

Posted

Now that's what I call "On Demand."

Posted
Now that's what I call "On Demand."

 

Agreed.

Although that I don't like to contribute on such way of addressing the thread but I feel that I have the time to write a quickie program to help the OP anyway.

 

It would be a good idea now to have a new button in the forum entitled 'BID on This task or project' :D

Posted

Thank you sir,

 

thank you so much for your quick reply, i am out of office i will check and let you know

Posted

Thank you sir,

 

thank you for your time, if it is quickie program also, for me its a big thing, i can save a lot of time :)

 

 

 

 

 

 

Agreed.

Although that I don't like to contribute on such way of addressing the thread but I feel that I have the time to write a quickie program to help the OP anyway.

 

It would be a good idea now to have a new button in the forum entitled 'BID on This task or project' :D

Posted

Sir its is working perfectly.

 

In the same lisp,insted of red colour suppose i need to change in to yellow. So where i need to edit in the lisp

 

Thanks

 

 

 

No problem, I am always happy to help.
Posted
Sir its is working perfectly.

 

In the same lisp,insted of red colour suppose i need to change in to yellow. So where i need to edit in the lisp

 

Thanks

 

Excellent.

 

Just change the number 1 to 2 like this (62 . 2) to convert to Yellow then you can increment this integer up to 256 which is equal to ByLayer.

Posted

Its working excellent sir,i can save my time.

While selection time can we add the selection in to new layer "estimate"

 

 

 

 

 

Excellent.

 

Just change the number 1 to 2 like this (62 . 2) to convert to Yellow then you can increment this integer up to 256 which is equal to ByLayer.

Posted
Its working excellent sir,i can save my time.

 

Good to hear.

 

While selection time can we add the selection in to new layer "estimate"

Yes we can and just as the following;

(entmod (append (entget ent) '([color="red"](8 . "estimate")[/color](62 . 1))))

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