Visual LISP, AutoLISP and General Customization
cancel
Showing results forย 
Showย ย onlyย  | Search instead forย 
Did you mean:ย 

Create highlight object (line, polyline, arc, spline...)

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
ancrayzy
410 Views, 4 Replies

Create highlight object (line, polyline, arc, spline...)

ancrayzy
Advocate
Advocate

Is there a way to create a lisp so that when we select one or more objects at the same time (line, polyline, arc, spline...), a copy will be created that overlaps that position and has a thicker lineweight than the current object?

The copied object will be assigned to a new layer with a different name.

I have attached an example drawing below ๐Ÿ™‚

For example

Layer name is : Highlight

Layer color is 2 (yellow)

Lineweight : 3mm

Regards!

Hightlight objects.jpg

โ€ƒ

0 Likes

Create highlight object (line, polyline, arc, spline...)

Is there a way to create a lisp so that when we select one or more objects at the same time (line, polyline, arc, spline...), a copy will be created that overlaps that position and has a thicker lineweight than the current object?

The copied object will be assigned to a new layer with a different name.

I have attached an example drawing below ๐Ÿ™‚

For example

Layer name is : Highlight

Layer color is 2 (yellow)

Lineweight : 3mm

Regards!

Hightlight objects.jpg

โ€ƒ

Tags (3)
4 REPLIES 4
Message 2 of 5
Kent1Cooper
in reply to: ancrayzy

Kent1Cooper
Consultant
Consultant
Accepted solution

You mean something like this:

(defun C:CHLL3 (/ ss); = Copy to Highlight Layer with Lineweight 3
  (if (setq ss (ssget "_:L"))
    (command
      "_.copy" ss "" '(0 0 0) '(0 0 0)
      "_.chprop" ss "" "_layer" "HIGHTLIGHT" "_color" "BYLAYER" "_lweight" 0.3 ""
    ); command
  ); if
  (prin1)
)

I spelled the Layer name with the extra T in the middle to match the name in your sample drawing.  If you really mean it without that, ensure the Layer name in the drawing agrees with that in the routine.

It could be made to create the Layer if it doesn't already exist.

Kent Cooper, AIA

You mean something like this:

(defun C:CHLL3 (/ ss); = Copy to Highlight Layer with Lineweight 3
  (if (setq ss (ssget "_:L"))
    (command
      "_.copy" ss "" '(0 0 0) '(0 0 0)
      "_.chprop" ss "" "_layer" "HIGHTLIGHT" "_color" "BYLAYER" "_lweight" 0.3 ""
    ); command
  ); if
  (prin1)
)

I spelled the Layer name with the extra T in the middle to match the name in your sample drawing.  If you really mean it without that, ensure the Layer name in the drawing agrees with that in the routine.

It could be made to create the Layer if it doesn't already exist.

Kent Cooper, AIA
Message 3 of 5
ancrayzy
in reply to: Kent1Cooper

ancrayzy
Advocate
Advocate

Thank you so much @Kent1Cooper 
The layer name call "Highligh" just for example only, I mistakenly typed "Hightlight" instead of "Highlight".

I tested this lisp and encountered the following 2 cases:

1. If there is a layer named "Hightlight" in the drawing. It work good.

2. If there isn't a layer named "Hightlight" in the drawing. It requires "Enter new layer name <0>:". And there are encountered 2 other cases:

- If we enter another name that exist in the drawing, there will be many options for us to continue such as: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]. It work good but do not save this setting for next time.

- If we want to create another layer that doesn't exist in the drawing, it will not allow it and we must exit the command to create the new layer manually. The problem is when we press "Esc" to exit the command, a copy of the objects is still created instead of deleting them. This will cause inaccuracies if we use these objects in counting.

I think it would be great if we can improve this lisp according to the following steps:

Step 1: type command > enter
Step 2: there are 2 options. [Quick/Option].
- If we choose Quick, the program will automatically create a layer named "Highlight", Layer color is 2, Lineweight : 3mm (for example, you can edit in lisp depending on our purpose).

- If we choose Option, the program will ask to type the layer name. This layer may already exist in the drawing or create a new layer. And save this option for the next time you run the command when you choose Quick.
Step 3: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative] And save this option for the next time you run the command when you choose Quick.

0 Likes

Thank you so much @Kent1Cooper 
The layer name call "Highligh" just for example only, I mistakenly typed "Hightlight" instead of "Highlight".

I tested this lisp and encountered the following 2 cases:

1. If there is a layer named "Hightlight" in the drawing. It work good.

2. If there isn't a layer named "Hightlight" in the drawing. It requires "Enter new layer name <0>:". And there are encountered 2 other cases:

- If we enter another name that exist in the drawing, there will be many options for us to continue such as: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]. It work good but do not save this setting for next time.

- If we want to create another layer that doesn't exist in the drawing, it will not allow it and we must exit the command to create the new layer manually. The problem is when we press "Esc" to exit the command, a copy of the objects is still created instead of deleting them. This will cause inaccuracies if we use these objects in counting.

I think it would be great if we can improve this lisp according to the following steps:

Step 1: type command > enter
Step 2: there are 2 options. [Quick/Option].
- If we choose Quick, the program will automatically create a layer named "Highlight", Layer color is 2, Lineweight : 3mm (for example, you can edit in lisp depending on our purpose).

- If we choose Option, the program will ask to type the layer name. This layer may already exist in the drawing or create a new layer. And save this option for the next time you run the command when you choose Quick.
Step 3: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative] And save this option for the next time you run the command when you choose Quick.

Message 4 of 5
Sea-Haven
in reply to: ancrayzy

Sea-Haven
Mentor
Mentor

Just some comments.

Step 3 may need a dcl with children buttons for each item, if click Color then say the acad_colordlg pops up so color can be changed, same with layer names use a list box, Ltype list box again, Ltscale is just a number maybe some presets. Same with Lweight, transparency a number, material a list box. Annotative yes or no. 

This is not a 5 minute task, if done as a type it I can see problems with incorrect spelling and code crashing.

 

Lastly use ldata and save the values so at any time the last entries are used as defaults.

 

Borders on a custom program for one user, may need to look at a paid solution.

Just some comments.

Step 3 may need a dcl with children buttons for each item, if click Color then say the acad_colordlg pops up so color can be changed, same with layer names use a list box, Ltype list box again, Ltscale is just a number maybe some presets. Same with Lweight, transparency a number, material a list box. Annotative yes or no. 

This is not a 5 minute task, if done as a type it I can see problems with incorrect spelling and code crashing.

 

Lastly use ldata and save the values so at any time the last entries are used as defaults.

 

Borders on a custom program for one user, may need to look at a paid solution.

Message 5 of 5
ancrayzy
in reply to: Sea-Haven

ancrayzy
Advocate
Advocate

Thanks for your help, I didn't think it was that complicated as your comment.

So, simply, I will use the 'CHLL3' at post #2 and modify something to fit my purposes first. And may think about paid solutions when really necessary to handle larger tasks.

0 Likes

Thanks for your help, I didn't think it was that complicated as your comment.

So, simply, I will use the 'CHLL3' at post #2 and modify something to fit my purposes first. And may think about paid solutions when really necessary to handle larger tasks.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report