pegasus Posted March 7, 2023 Author Posted March 7, 2023 actually here is the error when i check ; error: too many arguments: (IF (WCMATCH ( ... ) "letterhead A2 V,letterhead A2 H") (PROGN ( ... ) ( ... )) (SETQ RESP ( ... ) "\nChoose papersize [ISO full bleed A2 (594.00 x 420.00 MM)/ISO expand A3 (297.00 x 420.00 MM)] <A>: ") ... ) there is a problem in this part Quote
BIGAL Posted March 7, 2023 Posted March 7, 2023 (edited) I use this for finding missing brackets handy as it shows the open and close points. Its a answer that you need to understand what its producing. The final answer is a 0. CHKBRK.LSP Edited March 7, 2023 by BIGAL Quote
pegasus Posted March 8, 2023 Author Posted March 8, 2023 actually check out when stevenp edits and check the parenthesis missing and their position. After that I shared the error it gave. I also needed to connect you with the paper size definition in another way for too many argument (cond ..... there. On 3/7/2023 at 1:29 PM, Steven P said: Very quickly so I might have made a mistake, I've been through the code and added for example "End If" comments where the closing brackets are to make things clearer for me, also a couple of brackets on new lines just to make things clearer too. Might be a couple of things in this, the end cond bracket is quite a way off where it should be, and there is an if statement with 3 options - I think you want to look at (setq resp (getkword... ) again? (defun c:plot_pdf (/ en ent sc obj bas dwg file hnd i len llpt lst mn mx ss tab urpt) (if (setq ss (ssget '((0 . "INSERT")))) (progn (repeat (setq i (sslength ss)) (setq hnd (ssname ss (setq i (1- i))) tab (cdr (assoc 410 (entget hnd))) bas (cdr (assoc 10 (entget hnd))) ; get insert base point lst (cons (cons tab (cons bas hnd)) lst) ; include insert base point ) ; end setq ) ; end repeat ; (setq lst (vl-sort lst '(lambda (x y) (> (car x) (car y))))) ; sort by blocks insert base point x ascending = from left right (setq lst (vl-sort lst '(lambda (x y) (> (car (cadr y)) (car (cadr x)))))) ; sort by blocks insert base point y descending = from top down (setq lst (vl-sort lst '(lambda (x y) (< (cadr (cadr y)) (cadr (cadr x)))))) (setq i 0) (foreach x lst (setq file (strcat (getvar 'DWGPREFIX) (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4)) "-" (itoa (setq i (1+ i))) ".pdf" ) ) ; end setq (if (findfile file) (vl-file-delete file) ) ; end if ; (vla-getboundingbox (vlax-ename->vla-object (cdr x)) 'mn 'mx) (vla-getboundingbox (vlax-ename->vla-object (cddr x)) 'mn 'mx) (setq llpt (vlax-safearray->list mn) urpt (vlax-safearray->list mx) len (distance llpt (list (car urpt) (cadr llpt))) ) ; end setq (cond ((= blkname "letterhead A2 V")(setq sc "Fit" psize "ISO full bleed A2 (594.00 x 420.00 MM)" ll "-6,-6" ur "590,416" orien "Landscape")) ((= blkname "letterhead A2 V")(setq sc "1=1" psize "ISO full bleed A2 (594.00 x 420.00 MM)" ll "-6,-6" ur "590,416" orien "Landscape")) ((= blkname "letterhead A2 V")(setq sc "1=2" psize "ISO full bleed A2 (594.00 x 420.00 MM)" ll "-6,-6" ur "590,416" orien "Landscape")) ((= blkname "letterhead A2 V")(setq sc "1=3" psize "ISO full bleed A2 (594.00 x 420.00 MM)" ll "-6,-6" ur "590,416" orien "Landscape")) ((= blkname "letterhead A2 V")(setq sc "1=4" psize "ISO full bleed A2 (594.00 x 420.00 MM)" ll "-6,-6" ur "590,416" orien "Landscape")) ((= blkname "letterhead A2 V")(setq sc "1=5" psize "ISO full bleed A2 (594.00 x 420.00 MM)" ll "-6,-6" ur "590,416" orien "Landscape")) ((= blkname "letterhead A2 H")(setq sc "Fit" psize "ISO full bleed A2 (420.00 x 594.00 MM)" ll "-6,-6" ur "416,591" orien "Portrait")) ((= blkname "letterhead A2 H")(setq sc "Fit" psize "ISO expand A3 (297.00 x 420.00 MM)" ll "-3,-3" ur "280.4,403.5" orien "Portrait")) ((= blkname "letterhead A2 H")(setq sc "1=1" psize "ISO full bleed A2 (420.00 x 594.00 MM)" ll "-6,-6" ur "416,591" orien "Portrait")) ((= blkname "letterhead A2 H")(setq sc "1=2" psize "ISO full bleed A2 (420.00 x 594.00 MM)" ll "-6,-6" ur "416,591" orien "Portrait")) ((= blkname "letterhead A2 H")(setq sc "1=3" psize "ISO full bleed A2 (420.00 x 594.00 MM)" ll "-6,-6" ur "416,591" orien "Portrait")) ((= blkname "letterhead A2 H")(setq sc "1=4" psize "ISO full bleed A2 (420.00 x 594.00 MM)" ll "-6,-6" ur "416,591" orien "Portrait")) ((= blkname "letterhead A2 H")(setq sc "1=5" psize "ISO full bleed A2 (420.00 x 594.00 MM)" ll "-6,-6" ur "416,591" orien "Portrait")) ;;No End Cond bracket here? (while (setq ent (entsel "\nselect insert. >>")) (setq en ( car ent)) (if (wcmatch (cdr (assoc 0 (entget en))) "letterhead A2 V,letterhead A2 H") (progn (setq obj (vlax-ename->vla-object en)) (initget "ISO full bleed A2 (594.00 x 420.00 MM) ISO expand A3 (297.00 x 420.00 MM)" ) ) ; end progn (setq resp (getkword "\nChoose scale [Fit/1=1/1=2/1=3/1=4/1=5] <A>: " ) ; end getkword "\nChoose papersize [ISO full bleed A2 (594.00 x 420.00 MM)/ISO expand A3 (297.00 x 420.00 MM)] <A>: " ) ; end setq "\nChoose orrientation [Landscape/Portrait] <A>: " ) ; end if... 3 if options! (command "-plot" "Y" "" "DWG TO PDF.PC3" psize "m" Orientation "N" "W" ll ur sc "C" "y" "monochrome.ctb" "Y" "n" "n" "n" pdfName "N" "y") (if (/= (car x) "Model") (command "No" "No" file "no" "Yes") ; pspace (command file "no" "Yes") ; model ) ; end if ) ; end while ) ; end cond ) ; end foeach (princ) ) ; end progn ) ; end if ) ; end defun Quote
pegasus Posted April 26, 2023 Author Posted April 26, 2023 Let's make this topic a little easier. Actually, it will be enough to make the selected block objects auto-rotate sheets in the direction I choose. Is such a fix possible? It took a lot of time that I had in mind before and I couldn't succeed, if it is like this for now, it will see my work for a short time. I would appreciate your help. On 1/24/2023 at 3:14 PM, pegasus said: hello, I want to make the following list selection. For example, when you enter the command, page size, scale, plot style etc. can you help? Batch to create pdf in one go. (vl-load-com) (defun c:plot_pdf (/ bas dwg file hnd i len llpt lst mn mx ss tab urpt) (if (setq ss (ssget "_X" '((0 . "INSERT") (2 . "SHEET")))) (progn (repeat (setq i (sslength ss)) (setq hnd (ssname ss (setq i (1- i))) tab (cdr (assoc 410 (entget hnd))) bas (cdr (assoc 10 (entget hnd))) ; get insert base point lst (cons (cons tab (cons bas hnd)) lst) ; include insert base point ) ) ; (setq lst (vl-sort lst '(lambda (x y) (> (car x) (car y))))) ; sort by blocks insert base point x ascending = from left right (setq lst (vl-sort lst '(lambda (x y) (> (car (cadr y)) (car (cadr x)))))) ; sort by blocks insert base point y descending = from top down (setq lst (vl-sort lst '(lambda (x y) (< (cadr (cadr y)) (cadr (cadr x)))))) (setq i 0) (foreach x lst (setq file (strcat (getvar 'DWGPREFIX) (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4)) "-" (itoa (setq i (1+ i))) ".pdf" ) ) (if (findfile file) (vl-file-delete file) ) ; (vla-getboundingbox (vlax-ename->vla-object (cdr x)) 'mn 'mx) (vla-getboundingbox (vlax-ename->vla-object (cddr x)) 'mn 'mx) (setq llpt (vlax-safearray->list mn) urpt (vlax-safearray->list mx) len (distance llpt (list (car urpt) (cadr llpt))) ) (command "-plot" "yes" (car x) "DWG TO PDF.PC3" ; "ISO A3 (420.00 x 297.00 MM)" ; "ISO A1 (841.00 x 594.00 MM)" "ISO full bleed A4 (297.00 x 210.00 MM)" "Millimeters" "Portrait" "No" "Window" llpt urpt "Fit" ; "1:10" "Center" "yes" ; "grayscale.ctb" ; "Screening 75%.ctb" "monochrome.ctb" "yes" "" ) (if (/= (car x) "Model") (command "No" "No" file "no" "Yes") ; pspace (command file "no" "Yes") ; model ) ) ) ) (princ) ) 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.