Jump to content

Recommended Posts

Posted (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 by hosyn
Posted (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 by Roy_043
Posted
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)
 )

 

Posted (edited)

 

 

19 hours ago, hosyn said:

 


 ;; I CHANGED THIS TO "D://TEMP" FOR MY DETAIL FILE LOCATE

 

 

 

typo? //

"D://TEMP" ? "D:/TEMP" 

 

Edited by hanhphuc
Posted

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 , ??

Posted

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”

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...