b_gum Posted September 11, 2020 Posted September 11, 2020 So I have been trying to figure this out with several approaches now and I need some help. I would like to send all Wipeouts, or really any specified entity type, within a block to the back of the draw order. Is there a way to do this using Lee Mac's Apply To Block Objects routine? I tried this in conjunction with his draw order routines but the MovetoBottom command kept failing. I'm pretty rough with VisualLisp which is part of the issue when trying to troubleshoot his great routines. Or what about this approach? (I dont really understand it, again Visual Lisp) Below is what I tried. I do understand Vanilla Lisp. Visual Lisp I barely know the basics, but eager to learn. Please help me improve my capabilities. I love autolisp. Thank you. The issue is clearly with the lambda function and my improper use of it Im sure. The ssget I am trying to do is incorrect approach for use with his function. ;=========================================================== ; 11/Sep/2020 10:09 AM[Friday] AUTHOR: Brandon Gum ;-- ;DESCRIPTION: ;Select block with wipeout. ;Will send wipeout objects the back of the draw orer ;=========================================================== (defun c:test ( / s ) (princ "\nSelect Block: ") (if (setq s (ssget "_+.:E:S" '((0 . "INSERT")))) (LM:ApplytoBlockObjects (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (vla-get-effectivename (vlax-ename->vla-object (ssname s 0))) '(lambda ( obj ) (BG:WipeoutToBottom)) ) ) (princ) ) (vl-load-com) (princ) (defun BG:WipeoutToBottom( / ) (LM:movetobottom (ssget "X" '((0 . "WIPEOUT")))) ;(princ) );end of defun ;===============Below here are Lee's draw order functions============== My LeeMac Based Approach.LSP Quote
Tharwat Posted September 11, 2020 Posted September 11, 2020 Hi, Here is one way and the simplest one. (defun c:Test ( / sel) ;; Tharwat - 11.Sep.2020 ;; (and (princ "\nSelect a block: ") (setq sel (ssget "_+.:S:E:L" '((0 . "INSERT")))) (progn (command "_.bedit" (cdr (assoc 2 (entget (ssname sel 0))))) (if (setq sel (ssget "_X" '((0 . "~WIPEOUT")))) (command "_.draworder" sel "" "Front") ) (if (setq sel (ssget "_X" '((0 . "WIPEOUT")))) (command "_.draworder" sel "" "Back") ) (command "_.bclose" "Save") ) ) (princ) ) 1 Quote
dlanorh Posted September 11, 2020 Posted September 11, 2020 1 hour ago, b_gum said: So I have been trying to figure this out with several approaches now and I need some help. I would like to send all Wipeouts, or really any specified entity type, within a block to the back of the draw order. Is there a way to do this using Lee Mac's Apply To Block Objects routine? I tried this in conjunction with his draw order routines but the MovetoBottom command kept failing. I'm pretty rough with VisualLisp which is part of the issue when trying to troubleshoot his great routines. Or what about this approach? (I dont really understand it, again Visual Lisp) Below is what I tried. I do understand Vanilla Lisp. Visual Lisp I barely know the basics, but eager to learn. Please help me improve my capabilities. I love autolisp. Thank you. The issue is clearly with the lambda function and my improper use of it Im sure. The ssget I am trying to do is incorrect approach for use with his function. ;=========================================================== ; 11/Sep/2020 10:09 AM[Friday] AUTHOR: Brandon Gum ;-- ;DESCRIPTION: ;Select block with wipeout. ;Will send wipeout objects the back of the draw orer ;=========================================================== (defun c:test ( / s ) (princ "\nSelect Block: ") (if (setq s (ssget "_+.:E:S" '((0 . "INSERT")))) (LM:ApplytoBlockObjects (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (vla-get-effectivename (vlax-ename->vla-object (ssname s 0))) '(lambda ( obj ) (BG:WipeoutToBottom)) ) ) (princ) ) (vl-load-com) (princ) (defun BG:WipeoutToBottom( / ) (LM:movetobottom (ssget "X" '((0 . "WIPEOUT")))) ;(princ) );end of defun ;===============Below here are Lee's draw order functions============== My LeeMac Based Approach.LSP 4.07 kB · 0 downloads Try (defun c:test ( / s ) (princ "\nSelect Block: ") (if (setq s (ssget "_+.:E:S" '((0 . "INSERT")))) (LM:ApplytoBlockObjects (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (vla-get-effectivename (vlax-ename->vla-object (ssname s 0))) '(lambda ( obj ) (if (= "AcDbWipeout" (vlax-get obj 'objectname)) (LM:movetobottom (list obj)))) ) ) (princ) ) (vl-load-com) (princ) This will not alter dynamic blocks or some blocks with attributes as these will be anonymous and the routine gets the effectivename property which will point to the parent block. If you want it to work on anonymous blocks change (vla-get-effectivename ...) to (vla-get-name...) 1 Quote
b_gum Posted September 14, 2020 Author Posted September 14, 2020 Thank you guys. Both of those worked great. Learned a few good lessons from this one. Thank you for being responsive and helping me grow Quote
CAD_Noob Posted August 16, 2022 Posted August 16, 2022 On 9/11/2020 at 11:40 PM, Tharwat said: Hi, Here is one way and the simplest one. (defun c:Test ( / sel) ;; Tharwat - 11.Sep.2020 ;; (and (princ "\nSelect a block: ") (setq sel (ssget "_+.:S:E:L" '((0 . "INSERT")))) (progn (command "_.bedit" (cdr (assoc 2 (entget (ssname sel 0))))) (if (setq sel (ssget "_X" '((0 . "~WIPEOUT")))) (command "_.draworder" sel "" "Front") ) (if (setq sel (ssget "_X" '((0 . "WIPEOUT")))) (command "_.draworder" sel "" "Back") ) (command "_.bclose" "Save") ) ) (princ) ) What do I need to edit if I don't want to select a block? I need this to work on dynamic blocks btw... Quote
BIGAL Posted August 23, 2022 Posted August 23, 2022 If your talking visibilty states then more than likely will need use bedit and manually edit each visibilty state. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.