CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 3832
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

The information that you provide in this form will make up your forum profile which can be viewed by other forum members. Your email address will only be visible by forum admin and moderators and will be used to send you Forum Notifications. To cancel your account, use the page Opt-out or contact webmaster@cadforum.cz.

AutoCAD lisp routine for changing selectable objec

 Post Reply Post Reply
Author
remcokoedoot View Drop Down
Newbie
Newbie


Joined: 16.Oct.2013
Location: Netherlands
Using: AutoCAD
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote remcokoedoot Quote  Post ReplyReply Direct Link To This Post Topic: AutoCAD lisp routine for changing selectable objec
    Posted: 16.Sep.2022 at 11:42
AutoCAD lisp routine for changing selectable objects to color red 1

;;;; CHANGE-ENTITIES-TO-COLOR-RED-1.LSP - AutoCAD lisp routine voor het veranderen van te selecteren objecten naar color red 1
;;;; Versie 1.0
;;;; Start de AutoCAD-routine met AutoCAD commando: ch2cr1

(defun C:CH2CR1 ( / ss1 pt1 pt2)
      (graphscr)
      (setq pt1 '(0.0 0.0 0.0))
      (setq pt2 '(0.0 0.0 0.0))
      (setvar "cmdecho" 0)
      (prompt "Selecteer objecten om te veranderen naar color byblock:")
      (setq ss1(ssget))
      (command "move" ss1 "" pt1 "" pt2)
      (command "change" ss1 "" "P" "COLOR" "1" "")
      (prompt "\nDe veranderen-kleur-routine opdracht is beĆ«indigd, er zijn geen objecten meer geselecteerd. Start de routine opnieuw met AutoCAD commando: ch2cr1")
      (princ)
)
(princ "\nCHANGE-ENTITIES-TO-COLOR-RED-1.LSP - AutoCAD lisp routine voor het veranderen van te selecteren objecten naar color red 1.")
(princ "\nStart de veranderen-laag-routine met AutoCAD commando: ch2cr1")
(princ)



Edited by remcokoedoot - 16.Sep.2022 at 11:43
With kind regards,

Remco Koedoot
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2019
Status: Offline
Points: 563
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kent Cooper Quote  Post ReplyReply Direct Link To This Post Posted: 16.Sep.2022 at 20:53
Originally posted by remcokoedoot remcokoedoot wrote:

AutoCAD lisp routine for changing selectable objects to color red 1

;;;; CHANGE-ENTITIES-TO-COLOR-RED....
....
      (prompt "Selecteer objecten om te veranderen naar color byblock:")
....

[I think you need to fix your prompt.]


Edited by Kent Cooper - 16.Sep.2022 at 20:53
Back to Top
remcokoedoot View Drop Down
Newbie
Newbie


Joined: 16.Oct.2013
Location: Netherlands
Using: AutoCAD
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote remcokoedoot Quote  Post ReplyReply Direct Link To This Post Posted: 16.Sep.2022 at 23:02
For sure. The routine works.
What's the need in moving objects from position to the same position ? although if objects on locked layer then that won't work.
To keep the selected objects to a previous selection after this lisp has been executed.
Also when you set a new system variable then you need to set it back as it was.
And    (setvar "cmdecho" 0) must be indeed changed to:

 ;;;; CHANGE-ENTITIES-TO-COLOR-RED-1.LSP - AutoCAD lisp routine voor het veranderen van te selecteren objecten naar color red 1
;;;; Versie 1.0
;;;; Start de AutoCAD-routine met AutoCAD commando: ch2cr1

(defun C:CH2CR1 ( / dl_cmde ss1 pt1 pt2)
(graphscr)
(setq pt1 '(0.0 0.0 0.0))
(setq pt2 '(0.0 0.0 0.0))
(setq dl_cmde (getvar "cmdecho")) 
(setvar "cmdecho" 0)
(prompt "Selecteer objecten om te veranderen naar color 1 red:")
(setq ss1(ssget))
(command "move" ss1 "" pt1 "" pt2)
(command "change" ss1 "" "P" "COLOR" "1" "")
(setvar "cmdecho" dl_cmde)
(prompt "\nDe veranderen-kleur-routine opdracht is beƫindigd, er zijn geen objecten meer geselecteerd. Start de routine opnieuw met AutoCAD commando: ch2cr1")
(princ)
)
(princ "\nCHANGE-ENTITIES-TO-COLOR-RED-1.LSP - AutoCAD lisp routine voor het veranderen van te selecteren objecten naar color red 1.")
(princ "\nStart de routine met AutoCAD commando: ch2cr1")
(princ)
With kind regards,

Remco Koedoot
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,125 seconds.