I need to create a LISP routine that will allow you to select an object, find that objects layer, crate a new layer from the objects layer with a "V-DEMO-" layer name prefix and all the same setting as the original layer, then move the object to the new layer. Problem arises when the new layer already exists. I used a condition to determine if the new layer exists or not and if it does it moves the object to that layer as desired however; if the layer already exists it continues to add a "V-DEMO-" prefix and moves the object to that layer which is not the desired effect. I am fairly new to LISP and in over my head on this. Not sure if the condition statement itself is failing or if it is the False Condition command that is failing. Any help would be greatly appreciated, Thanks, in advance
(defun c:demolay
(/ ent elay newlay) ;Defines Variables
(setq ent (entsel "\nSelect entity on layer to duplicate: ")) ;Sets variable ENT to selected object
(setq elay (cdr (assoc 8 (entget (car ent))))) ;Sets Variable ELAY to layer of object ENT
(setq newlay (strcat "V-DEMO-" elay)) ;Sets Variable NEWLAY by adding "V-DEMO-LAY to ENT
(cond ((tblsearch "LAYER" newlay) ;Test to seey if layer NEWLAY exists
(command "_.chprop" ent "" "LA" newlay "")) ;True Condition - Move object ENT to that layer
((progn (setq laylist (entget (tblobjname "layer" elay)) laylist (subst (cons 2 newlay) (assoc 2 laylist) laylist ))
(entmake laylist)
(command "_.chprop" ent "" "LA" newlay ""))
);False Condition - Make layer NEWLAY while copying setting from ELAY and moves object ENT to layer NEWLAY
);Close Conditions
(princ)
);Close Function
.
As the Ribbon and Quick Access Toolbar gives access to hundreds of macros with all the panels and tabs including lots of Ribbon Control Elements that couldn't be accessed any other way, haven't used any of the old style menus & toolbars in 11 years.
Love how the interface can be customized to whatever anyone wants.
Sorry, but I disagree. The fixed panels should be on the outside and the moveable panels on the inside. Something like these doors from Renewal by Anderson.
If it's a shower, you want the panels on the inside, so water doesn't gum up the works. If it's an exterior door, you want the panels on the outside, for the same reason. If there's no water involved, then it comes down to security (locks on the inside) or aesthetics.
Edit: Please disregard this comment, per ReMark below.
Click on the little button at the far bottom right that looks like 3 horizontal lines. This will open a pop up menu where you can turn off the buttons you don't want.
Hi,
Give this a shot.
(defun c:Test ( / sty tbl obj row col r c)
;; Tharwat - Date: 11.Jul.2017 ;;
(setq sty "Standard") ;; Change the Text Style to suit your desired one.
(if (and (or (tblsearch "STYLE" sty)
(alert (strcat "Text style <" sty "> is not found in drawing <!>"))
)
(princ "\nPick on Table :")
(setq tbl (ssget "_+.:S:E:L" '((0 . "ACAD_TABLE"))))
(setq obj (vlax-ename->vla-object (ssname tbl 0))
row (vla-get-rows obj)
col (vla-get-columns obj)
r 0 c 0
)
)
(repeat row
(repeat col
(vla-setcelltextstyle obj r c sty) (setq c (1+ c))
)
(setq r (1+ r) c 0)
)
)
(princ)
) (vl-load-com)