LSP Command to change User Section Layers Easily

LSP Command to change User Section Layers Easily

Anonymous
Not applicable
470 Views
2 Replies
Message 1 of 3

LSP Command to change User Section Layers Easily

Anonymous
Not applicable

Hi Everyone,

 

I have a copied LSP routine from another forum from a few years ago, and I thought I had added everything needed for Advance Steel. I get to the point where I need to select the layer but it wont and states invalid option keyword.

(defun c:USc ( / layers layer ss )

  (setq layers '(
"Hype_Frame"
"Hype_TypeName" 
"Hype_SectionName" 
"Hype_OuterSection" 
"Hype_ExactOuterSection" 
"Hype_InnerSection" 
"Hype_ExactInnerSection")
)

  (initget 1 "Hype_Frame Hype_TypeName Hype_SectionName Hype_OuterSection Hype_ExactOuterSection Hype_InnerSection Hype_ExactInnerSection")
  (setq layer (getkword "\nChoose Target Layer [A_Hype_Frame/B_Hype_TypeName/C_Hype_SectionName/D_Hype_OuterSection/E_Hype_ExactOuterSection/F_Hype_InnerSection/G_Hype_ExactInnerSection] : "))

  (setq layer (car (member layer layers)))

  (if (setq ss (ssget "_:L"))
    (command "_.chprop" ss "" "_LA" layer ""))

  (princ))

Above is the routine, and any help would be great highlighting the errors inside.

 

Thank you.

0 Likes
471 Views
2 Replies
Replies (2)
Message 2 of 3

pbejse
Mentor
Mentor

@Anonymous wrote:

Hi Everyone,

Above is the routine, and any help would be great highlighting the errors inside.

 

Thank you.


Could be written this way

 

(setq layers '(
		("A" "Hype_Frame")
		("B"" Hype_TypeName")
		("C" "Hype_SectionName")
		("D" "Hype_OuterSection")
		("E" "Hype_ExactOuterSection") 
		("F" "Hype_InnerSection")
		("G" "Hype_ExactInnerSection")
		)
	)

(initget 1 "A B C D E F G")
(setq layer (getkword "\nChoose Target Layer [A Hype_Frame/B Hype_TypeName/C Hype_SectionName/D Hype_OuterSection/E Hype_ExactOuterSection/F Hype_InnerSection/G Hype_ExactInnerSection] : "))

(setq layer (cadr (assoc layer layers)))

 

You can also use numbers.

 

...  
(setq layers '(
	"Hype_Frame"
	"Hype_TypeName" 
	"Hype_SectionName" 
	"Hype_OuterSection" 
	"Hype_ExactOuterSection" 
	"Hype_InnerSection" 
	"Hype_ExactInnerSection")
	)
(initget 1 "1 2 3 4 5 6 7")
(setq layer (getkword "\nChoose Target Layer [1 Hype_Frame/2 Hype_TypeName/3 Hype_SectionName/4 Hype_OuterSection/5 Hype_ExactOuterSection/6 Hype_InnerSection/7 Hype_ExactInnerSection] : "))
(setq layer (nth (1- (atoi layer)) layers))
...

 

HTH

 

0 Likes
Message 3 of 3

Sea-Haven
Mentor
Mentor

Another using dcl

 

 

(if (not AH:Butts)(load "Multi radio buttons.lsp"))
(if (not but)(setq but 1))
(setq layers '("Please choose" 
	"Hype_Frame"
	"Hype_TypeName" 
	"Hype_SectionName" 
	"Hype_OuterSection" 
	"Hype_ExactOuterSection" 
	"Hype_InnerSection" 
	"Hype_ExactInnerSection")
	)
(setq ans (ah:butts but "V" layers))

 

SeaHaven_0-1623980867931.png

 

0 Likes