hosyn Posted July 21, 2020 Posted July 21, 2020 (edited) Hello guys I was looking for the ways for keeping detail dwg file and invoking them in drawing in the appropriate way and i happend to found some , but after testing it shows error in apartial at: ;;;;; Bring in block Detail Callout IMP r03 block from MVVA Callouts_Imperial r01.dwg (defun open_dbx (dwg / dbx) (if (< (atoi (substr (getvar "ACADVER") 1 2)) 16) (setq dbx (vlax-create-object "ObjectDBX.AxDbDocument")) (setq dbx (vlax-create-object (strcat "ObjectDBX.AxDbDocument." (substr (getvar "ACADVER") 1 2) ) ) ) ) (vla-open dbx dwg) dbx ) (setq Dbx (open_dbx "//ny-fs01/cad_common$/AutoCAD 2014/Drawings/MVVA Callouts_Imperial r01.dwg")) ;; I CHANGED THIS TO "D://TEMP" FOR MY DETAIL FILE LOCATE (vla-CopyObjects Dbx (vlax-safearray-fill (vlax-make-safearray vlax-vbObject '(0 . 0)) (list (vla-item (vla-get-blocks dbx) "Detail Callout IMP r03")) ) (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)) ) ) (vlax-release-object dbx) And shows following error after running: error: too many arguments Cannot invoke (command) from *error* without prior call to (*push-error-using-command*). Converting (command) calls to (command-s) is recommended. Edited July 21, 2020 by hosyn Quote
Roy_043 Posted July 21, 2020 Posted July 21, 2020 (edited) A small request: can you please, please switch off caps lock when you write your posts? Reading an all caps text is ANNOYING. Edited July 21, 2020 by Roy_043 Quote
hosyn Posted July 21, 2020 Author Posted July 21, 2020 2 hours ago, Roy_043 said: A small request: can you please, please switch off caps lock when you write your posts? Reading an all caps text is ANNOYING. Good point sorry, I modified it, Any idea about issue and the complete code at following: (defun C:ADB( / CL COSM FRAD CAS NHS PLW) ;;;;; Collect current layer, and OSMODE settings (setq CL (getvar "CLAYER")) (setq COSM (getvar 'osmode)) ;;;;; Set OSPMODE to ENDPOINT and MIDPOINT only (setvar 'osmode 4131) ;;;;; Collect current annotation scale value and create Values for POLYLINE WIDTH width and FILLET RADIUS (setq CAS (getvar 'cannoscalevalue)) (setq NHS (/ 1 CAS)) (setq PLW (* NHS 0.0625)) (setq FRAD (* 10 PLW)) ;;;;; Create layer for the detail box and make it current (command "_.-Layer" "m" "L-DTL-BOX" "c" "5" "L-DTL-BOX" "l" "DASHED" "L-DTL-BOX" "") (setvar 'CLAYER "L-DTL-BOX") ;;;;; Draw the box using pline width and fillet radius values (command "_.rectang" "_f" FRAD (while (> (getvar 'CmdActive) 0) (command pause))) (command "_.PEDIT" "L" "L" "on" "w" PLW "") (command "_.rectang" "_f" "0") (command) ;;;;; Create the layer fo the detail tag and make it current (command "_.-Layer" "m" "L-ANNO-SYMB" "c" "3" "L-ANNO-SYMB" "") (setvar 'CLAYER "L-ANNO-SYMB") ;;;;; Bring in block Detail Callout IMP r03 block from MVVA Callouts_Imperial r01.dwg (defun open_dbx (dwg / dbx) (if (< (atoi (substr (getvar "ACADVER") 1 2)) 16) (setq dbx (vlax-create-object "ObjectDBX.AxDbDocument")) (setq dbx (vlax-create-object (strcat "ObjectDBX.AxDbDocument." (substr (getvar "ACADVER") 1 2) ) ) ) ) (vla-open dbx dwg) dbx ) (setq Dbx (open_dbx "//ny-fs01/cad_common$/AutoCAD 2014/Drawings/MVVA Callouts_Imperial r01.dwg")) (vla-CopyObjects Dbx (vlax-safearray-fill (vlax-make-safearray vlax-vbObject '(0 . 0)) (list (vla-item (vla-get-blocks dbx) "Detail Callout IMP r03")) ) (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)) ) ) (vlax-release-object dbx) ;;;;; Insert Detail Callout IMP r03 block ;;; (command ".-insert" "Detail Callout IMP r03" PAUSE "1" "1" "0") ;;;;; Retuen current layer and OOMODE to original values (setvar 'CLAYER CL) (setvar 'OSMODE COSM) ;;;;; change visibility state of Detail Callout IMP r03 block to "None" (defun CHGDYNPROP (Ename propname newval / lo obj v vval sal tot i) ;; Changes a given variable in your block ;; Passed: Ename, Property Name, New value for Property ;; (setq obj (if (= (type Ename) 'vla-object) Ename (vlax-ename->vla-object Ename)) v (vla-getdynamicblockproperties obj) vval (vlax-variant-value v) sal (vlax-safearray->list vval) tot (length sal) i 0) (while (< i tot) (if (= (vlax-get-property (nth i sal) "PropertyName") propname) (progn (vlax-put-property (nth i sal) "Value" newval) (setq i tot) ) (setq i (1+ i)) ) ) ) (CHGDYNPROP (entlast) "Visibility1" "None") ;none is the visibility state name (princ) ) Quote
hanhphuc Posted July 21, 2020 Posted July 21, 2020 (edited) 19 hours ago, hosyn said: ;; I CHANGED THIS TO "D://TEMP" FOR MY DETAIL FILE LOCATE typo? // "D://TEMP" ? "D:/TEMP" Edited July 21, 2020 by hanhphuc Quote
hosyn Posted July 21, 2020 Author Posted July 21, 2020 I changed but do nothing well yet, This lisp call Drawings/MVVA Callouts_Imperial r01.dwg" And i havent it , maybe i dont choose proper dwg instead , ?? Quote
BIGAL Posted July 21, 2020 Posted July 21, 2020 A double // at start of file name implies a server //my server/myfiles or \\\\myserver\\myfiles so for me “d:/acadtemp/dwg1” ”d:\\acadtemp\\dwg1” 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.