Command to close layer panel

Command to close layer panel

jtm2020hyo
Collaborator Collaborator
1,249 Views
10 Replies
Message 1 of 11

Command to close layer panel

jtm2020hyo
Collaborator
Collaborator

I am trying create a simple lisp routine to create layer with their filter, but i found an error in AutoCAD 2023 Student Version when i run my lisp :

 

(command "_.-layer" "m" "30L-AULAS-SUELO-" "") (command "_.-layer" "_FILTER" "N" "G" "" "30L-AULAS-SUELO-" "30L-") (command "")

 

this error is something related to Microsoft, so, probably there is not easy solution, but I can dodge this error closing the Layer Panel.

 

then... What is the command to close and re-open the Layer Panel, Or How can I manage this?

0 Likes
Accepted solutions (3)
1,250 Views
10 Replies
Replies (10)
Message 2 of 11

Kent1Cooper
Consultant
Consultant

@jtm2020hyo wrote:

.... i found an error in AutoCAD 2023 Student Version when i run my lisp :

....

this error is something related to Microsoft....


What is the error, and what makes you think it is related to Microsoft?

 

Is there some reason not to consolidate?

(command "_.-layer" "_FILTER" "N" "G" "" "30L-AULAS-SUELO-" "30L-" "")

Kent Cooper, AIA
0 Likes
Message 3 of 11

ronjonp
Mentor
Mentor
Accepted solution

@jtm2020hyo 

There is also the LAYERCLOSE command.

Message 4 of 11

Kent1Cooper
Consultant
Consultant

@ronjonp wrote:

There is also the LAYERCLOSE command.


But how you invoke that with the Layer Properties Manager open, I don't know.  That won't be opened by AutoLisp (command "_.layer" ....), unless preceded by (initdia), but then the AutoLisp function will have to wait until you close that yourself before it could go on to what happens next, so closing it in AutoLisp doesn't seem relevant.  So,  @jtm2020hyo, how are you getting to the point of having the Layer panel open, if you're running an AutoLisp routine?

Kent Cooper, AIA
Message 5 of 11

ronjonp
Mentor
Mentor

I'd imagine he'd just run (command "_.layerclose") before creating the layer and filter.

I could replicate the error.

ronjonp_0-1657911405736.png

 

 

 

 

Message 6 of 11

ronjonp
Mentor
Mentor
Accepted solution

@jtm2020hyo 

This is what I use to create layer filters:

 

(defun _makelayerfilters (patterns / dict xdict)
  (setq	xdict (vlax-vla-object->ename
		(vla-getextensiondictionary
		  (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
		)
	      )
	dict  (if (setq dict (dictsearch xdict "ACAD_LAYERFILTERS"))
		(cdr (assoc -1 dict))
		(dictadd xdict
			 "ACAD_LAYERFILTERS"
			 (entmakex '((0 . "dictionary") (100 . "AcDbDictionary") (280 . 0) (281 . 1)))
		)
	      )
  )
  (foreach x patterns
    (dictadd dict
	     (car x)
	     (entmakex (list '(0 . "XRECORD")
			     '(100 . "AcDbXrecord")
			     '(280 . 1)
			     (cons 1 (car x))
			     (cons 1 (cadr x))
			     (cons 1 (caddr x))
			     (cons 1 (cadddr x))
			     '(70 . 0)
			     '(1 . "*")
			     '(1 . "*")
		       )
	     )
    )
  )
  (princ)
)
;; Example
;; Name of Filter | Layer Name Wildcard | Color | Linetype
(_makelayerfilters
  '(("_NoXref" "~*|*" "*" "*")
    ("_Mask" "*MASK*" "*" "*")
    ("_Color 8" "*" "8" "*")
    ("_Add Alternate" "*add*alt*" "*" "*")
    ("_Bid Alternate" "*bid*alt*" "*" "*")
    ("_Demo" "*demo*" "*" "*")
    ("_Existing" "*exist*,*ex*" "*" "*")
    ("_Hardscape" "*sidewalk*,*sw*,*curb*,*walk*,*-lip*,*tbc*" "*" "*")
    ("_Contours" "*contour*,*cont-*,*cp cont*,*p-cont*" "*" "*")
   )
)
;; Example to set one current
(command "_.+layer" "_Mask")

 

Message 7 of 11

jtm2020hyo
Collaborator
Collaborator

How can I re-open the Layer Panel without use "LAYER"? I tried "_.Layer" but this just drop property options.

jtm2020hyo_0-1657921266859.png

 



0 Likes
Message 8 of 11

Kent1Cooper
Consultant
Consultant
Accepted solution

@jtm2020hyo wrote:

How can I re-open the Layer Panel without use "LAYER"? ....


(initdia)

(command "_.layer" ....

Kent Cooper, AIA
Message 9 of 11

ВeekeeCZ
Consultant
Consultant

@ronjonp wrote:

I'd imagine he'd just run (command "_.layerclose") before creating the layer and filter.

I could replicate the error.

ronjonp_0-1657911405736.png

 


 

@jtm2020hyo @ronjonp 

 

Even with 2023.1 update? Reported?

Message 10 of 11

ronjonp
Mentor
Mentor

 


@ВeekeeCZ wrote:

@ronjonp wrote:

I'd imagine he'd just run (command "_.layerclose") before creating the layer and filter.

I could replicate the error.

ronjonp_0-1657911405736.png

 


 

@jtm2020hyo @ronjonp 

 

Even with 2023.1 update? Reported?


@ВeekeeCZ It errors on that version too.

Message 11 of 11

nislam04
Participant
Participant

MyDreamLisp-2022Sep20.jpg