Message 1 of 23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the code below that works, but I am not completely sure why it works. For example, line 6, the tblsearch command returns what exactly (I have looked here, but it is not enough information for my understanding). Within the condition statement between lines 5 and 8 how is that telling the code that the layer exists.
I have the same question about the member command in line 64. What exactly is happening with the code? Again, I have checked that it wo...
Is there a more extensive description of how tblsearch and member work with all the arguments that can be passed through it?
Thanks!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ECR:deleteLayer ( LAYER / )
;; CHECKS IF LAYER EXISTS BEFORE DELETING LAYER
;; ADD TEXT TO ADD IF IT DOESN'T EXIST (CONDITION ELSE?)
(cond
((tblsearch "layer" LAYER)
(command "-laydel" "name" LAYER "" "yes")
);LAYER EXISTS
(t
(princ (strcat "\n-\n" LAYER " does not exist to be deleted\n-\n"))
);ELSE
);COND
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ECR:setCurrentLayer ( LAYER / )
;; SET CURRENT LAYER
;; ADD SOME ERROR CHECKING TO CHECK IF THE LAYER EXISTS
;; ADD TEXT TO ADD IF IT DOESN'T EXIST
(cond
((tblsearch "layer" LAYER)
(command "-layer" "set" LAYER "")
); LAYER EXISTS
(t
(command "-layer" "set" "1-DUMP" "")
(princ (strcat "\n-\n" LAYER " does not exist to be set to current (setCurrentLayer). Layer ''1-DUMP'' Set to current\n-\n"))
);ELSE
);COND
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ECR:thawLayer ( LAYER / )
;; SET CURRENT LAYER
;; ADD SOME ERROR CHECKING TO CHECK IF THE LAYER EXISTS
;; ADD TEXT TO ADD IF IT DOESN'T EXIST
(cond
((tblsearch "layer" LAYER)
(command "-layer" "THAW" LAYER "")
);LAYER EXISTS
(t
(princ (strcat "\n-\n" LAYER " does not exist to be thawed (thawLayer).\n-\n"))
);ELSE
);cond
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ECR:setTab ( TAB / )
;; CHANGE TABS AND DO ZOOM EXTENTS ON THAT TAB
(cond
((member TAB (layoutlist))
(setvar "ctab" TAB)
(command "zoom" "extents")
);LAYOUT NAME EXISTS
(t
(princ (strcat "\n-\n" TAB " does not exist to be set (setTab).\n-\n"))
);ELSE
);COND
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ECR:deleteTab ( TAB / )
;; DELETES TAB BUT FIRST CHECK IF THE TAB EXISTS BEFORE TRYING TO DELETE
(cond
((member TAB (layoutlist))
(command "-layout" "delete" TAB)
);LAYOUT NAME EXISTS
(t
(princ (strcat "\n-\n" TAB " does not exist to be deleted (deleteTab).\n-\n"))
);ELSE
);COND
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ECR:renameTab ( OLD_TAB NEW_TAB / )
;; RENAME TAB BUT FIRST CHECK IF THE TAB EXISTS BEFORE TRYING TO RENAME
(cond
((member OLD_TAB (layoutlist))
(command "-layout" "Rename" OLD_TAB NEW_TAB)
);LAYOUT NAME EXISTS
(t
(princ (strcat "\n-\n" OLD_TAB " does not exist to be renamed (renameTab).\n-\n"))
);ELSE
);COND
(princ)
)
Solved! Go to Solution.