- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello All,
I know there is tons of posts on this topic, and I have done my best to format according to the examples that I see, but I am not getting anything when I run my code snippet below. What I am trying to do is removing layouts according the amount of floors a model home has. The variable "Floor_Count" is set by another function prior to this one running. But, when I run the code below, it does not remove any of the layouts. The options available are 1, 2, 3, and 4. If 1, 2, or 3 are selected, then it will remove the appropriate sheets. If 4 is selected, then no sheets will be removed. I have tried using "(and (= Floor_Count 1))..." but I get the same results as well. Any insight on what I am missing?
(defun DeleteFloorLayouts ( / cmd FloorLayouts x)
;Remove Floor Layouts
(foreach x FloorLayouts
(vl-catch-all-apply
'vla-add
(list (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) x)
)
(cond
((/= Floor_Count 1)
(setq FloorLayouts '("E2_AL" "M2_AL" "P2_AL" "E3_AL" "M3_AL" "P3_AL" "E4_AL" "M4_AL" "P4_AL"))
(command "-LAYOUT" "_d" x)
(princ "\nExcess floor layouts for the 2nd-4th floors removed\n")
)
((/= Floor_Count 2)
(setq FloorLayouts '("E3_AL" "M3_AL" "P3_AL" "E4_AL" "M4_AL" "P4_AL"))
(command "-LAYOUT" "_d" x)
(princ "\nExcess floor layouts for the 3rd And 4th floors removed\n")
)
((/= Floor_Count 3)
(setq FloorLayouts '("E4_AL" "M4_AL" "P4_AL"))
(command "-LAYOUT" "_d" x)
(princ "\nExcess floor layouts for the 4th floor removed\n")
)
;if 4 floors, remove nothing
(princ "\nNO floor layouts removed!\n")
)
)
(princ)
);defun
Solved! Go to Solution.