Jump to content

Recommended Posts

Posted

I am using draworder as follow:

 

; ss is not empty!

(sssetfirst ss)

(command "_.draworder" ss "" "_F")

 

It works fine, doing what it is supposed to do. The only problem is that after I execute it, i received this message:

 

Unknown command "F". Press F1 for help.

 

It seems that it does not recognize the "_F" final token

 

I am in PAPER SPACE (may be this is the problem?!), and the objects en ss are also in PAPER SPACE

 

thanks...

Posted

I can't see an error in your code above, except that you may want to use (sssetfirst nil ss).

 

If you are still having problems - look into altering the draworder using VL. :)

Posted

I wrote this lisp for work. I personally use it all the time. You can try remaking it to fit your needs or just use it as is.

 

;|************************************************************************
**************************************************************************
********************A different approach at DRAWORDER*********************
******************************By: ZRABOIN*********************************
**************************************************************************
************************************************************************|;
(defun c:ndo( / cord goto adoc obj obj1 obj2 ent)
 (vl-load-com)
 (setq cord (vla-addobject
          (vla-GetExtensionDictionary
        (vla-get-modelspace
          (setq adoc (vla-get-activedocument
               (vlax-get-acad-object))))) "ACAD_SORTENTS" "AcDbSortentsTable"))
 (initget "1 2 3 4 5 6")
 (setq goto (cond ((getkword "\nWould you like to (1)-Bringtofront (2)-Sendtoback (3)-Sendbehind (4)-Bringabove (5)-SwapObjects (6)-Special ?: <bringtoFront> ")) ("1")))
 (cond
   ((and (= goto "1")
     (setq ent (mkar)))
    (vla-Movetotop cord ent))
   ((and (= goto "2")
     (setq ent (mkar)))
    (vla-Movetobottom cord ent))
   ((and (= goto "3")
     (setq ent (mkar)))
    (setq obj (entsel "\nSelect Reference Object: "))
    (setq obj (vlax-ename->vla-object (car obj)))
    (vla-Movebelow cord ent obj))
   ((and (= goto "4")
     (setq ent (mkar)))
    (setq obj (entsel "\nSelect Reference Object: "))
    (setq obj (vlax-ename->vla-object (car obj)))
    (vla-Moveabove cord ent obj))
   ((and (= goto "5")
     (setq obj1 (vlax-ename->vla-object(car(entsel))))
     (setq obj2 (vlax-ename->vla-object(car(entsel)))))
    (vla-SwapOrder cord obj1 obj2))
   ((and (= goto "6")
     (setq obj (mksar)))
    (vla-setRelativeDrawOrder cord obj)
    )
   )
 (vla-regen adoc acActiveViewport)
 )


;******************************Make Array**********************************************************************

(defun mkar ( / ss arobj)
 (if (setq ss (ssop))
 (setq ss (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
   arobj (vlax-safearray-fill (vlax-make-safearray vlax-vbobject (cons 0 (- (length ss) 1))) ss)))
 )

;******************************Make Array Multiple Selections**************************************************
(defun mksar ( / ss s1 arobj)
 (while (setq s1 (ssop))
   (setq ss (append (vl-remove-if '(lambda (z) (member z ss)) (vl-remove-if 'listp (mapcar 'cadr (ssnamex s1)))) ss)))
 (setq    arobj (vlax-safearray-fill (vlax-make-safearray vlax-vbobject (cons 0 (- (length ss) 1))) (mapcar 'vlax-ename->vla-object ss)))
 )

;******************************Selection Set Options************************************************************
(defun ssop ( / ssmeth s1 ss)
 (initget "1 2 3 4")
 (setq ssmeth (cond ((getkword "\nSelect by: (1)-Specified Objects (2)-Layer (3)-Blockname (4)-Similar - <Specified Objects> : ")) ("1")))
 (setq curt (getvar "ctab"))
 (cond ((= ssmeth "1")
    (setq ss(ssget)))
   ((= ssmeth "2")
    (if (setq ss (entsel "\nSelect an object on the layer you want: "))
      (ssget "X" (list (cons 410 curt) (cons 8 (cdr (assoc 8 (entget (car ss)))))))))
   ((= ssmeth "3")
    (if (setq ss (entsel "\nSelect a block: "))
      (if (= (cdadr (setq ss (entget (car ss)))) "INSERT")
        (setq ss (ssget "X" (list (cons 410 curt) (cons 2 (cdr (assoc 2 ss)))))))
      ))
   ((= ssmeth "4")
    (if (setq ss (entsel "\nSelect an object: "))
      (progn
        (if (= (cdadr (setq ss (entget (car ss)))) "INSERT")
          (setq s1 (cons 2 (cdr (assoc 2 ss))))
          (setq s1 (cons 0 (cdr (assoc 0 ss)))))
        (setq ss (ssget "X" (list s1 (cons 410 curt) (cons 8 (cdr (assoc 8 ss)))))))
      )))
 )

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...