Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Another block definition in code and ordering pages

0 REPLIES 0
Reply
Message 1 of 1
JelleDJs
180 Views, 0 Replies

Another block definition in code and ordering pages

Hello everyone,

 

A while ago, I got the following code which works good.

 

However, we want to be able to select another block definition.

How do I add that, or can someone give me the edited code?

 

We also have a second issue.

The code below automatically orders the pages in the order of: 01.01A, 01.01B, 01.01

Is it possible to change the order it gets to: 01.01, 01.01A, 01.01B

(defun c:Printen_liggend ( /  Bladnr sheet Tblocks i e pts order)
(if
  (setq Tblocks (ssget '((0 . "INSERT")(66 . 1)(2 . "PRINTBLAD"))
			   )
		    )
  (progn
    (repeat (setq i (sslength Tblocks))
      (setq e (vlax-ename->vla-object (ssname Tblocks (setq i (1- i)))))
	(vla-GetBoundingBox e 'll 'ur)
        (setq pts (mapcar '(lambda (p)
		    (setq pt (vlax-safearray->list p))
			     (list (car pt)(cadr pt))) (list ll ur)))
      	(setq Bladnr (vl-some '(lambda (At)
				 (if (eq "Bladnr." (vla-get-tagstring at))
				   (vla-get-textstring at)))	 
	  			(vlax-invoke e 'GetAttributes)
			      )
	      )
      	(setq order (cons (list Bladnr pts) order)
	      )
      )
    (setq order
	   (vl-sort order '(lambda (a b)
		       (< (distof (car a))(distof (car b)))))
	  )
      
(while (setq sheet (Car order))  
	  (command "PLOT" "Y" ""
	           ;"DWG to PDF"
		   ;"ISO A3 (420.00 x 297.00 MM)"
             "PDFCreator"
       "A3"
		   "M"
	           "L" "N" "W"
	           "_non" (caadr sheet) "_non" (cadadr sheet)
	           "F" "C" "Y" "2D_HSB HP" "Y" "A"
		   ;(car sheet)
	           "N" "Y" "Y")
  	(setq order (cdr order))
	)
    )
  )
(princ)
)

 

 In case it wasn't clear, English isn't my motherlanguage. So if there are spelling mistakes, it is because of that.

 

Thanks in advance.

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report