Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/11/2024 in all areas

  1. cant reproduce your error , all sunny on my side maybe change last line to (setq object-list nil object-safe-array nil dbx nil) or set some debug points in your lisp editor and see if for example object-list / safe-array is created correctly else use wblock , maybe not high-tech but if it gets the job done, who cares. well I'm of to site for a couple of hours now... ps. and check if your filename has no invalid characters in it
    1 point
  2. You're welcome (although I feel I just created lisp version for the wblock command )
    1 point
  3. ;;; copy to new doc (defun ctnd ( ss new-dwg-name / SS->OL dbx_ver acApp acDoc dbx object object-list object-safe-array) (defun SS->OL (ss / i l) (setq i 0)(repeat (sslength ss)(setq l (cons (vlax-ename->vla-object (ssname ss i)) l) i (1+ i))) l) (defun dbx_ver ( / v) (strcat "objectdbx.axdbdocument" (if (< (setq v (atoi (getvar 'acadver))) 16) "" (strcat "." (itoa v))))) (setq acApp (vlax-get-acad-object) acDoc (vla-get-ActiveDocument acApp)) (setq dbx (vl-catch-all-apply 'vla-getinterfaceobject (list (vlax-get-acad-object) (dbx_ver)))) (vl-catch-all-apply 'vla-saveas (list dbx new-dwg-name)) ; put all objects in a list (foreach object (ss->ol ss) (setq object-list (cons object object-list))) ; put list with objects in a safe array (setq object-safe-array (vlax-make-safearray vlax-vbobject (cons 0 (1- (length object-list))))) (vl-catch-all-apply 'vlax-safearray-fill (list object-safe-array object-list)) ; copy objects to wblock-dbx-container (vla-CopyObjects acDoc object-safe-array (vla-get-ModelSpace dbx)) (vl-catch-all-apply 'vla-saveas (list dbx new-dwg-name)) (vl-catch-all-apply 'vlax-release-object (list dbx)) (setq object-list nil object-safe-array nil) (princ) ) (defun c:t2 ( / ss new-dwg ) (if (and (setq ss (ssget))(setq new-dwg (getfiled "Copy objects to :" (getvar 'dwgprefix) "dwg" 1))) (ctnd ss new-dwg) ) (princ) )
    1 point
  4. Difficult task as you have implied different rules within the shapes I think its because you have done it manually. If you were to do offset of shape and insert along that could be done with multiple offsets. Look at your right hand shape.
    1 point
  5. probably not exactly what you want but should be relatively easy to modify to copy to all open drawings ;;; copy to drawing (defun ctd ( ss dwg / ss->ol dbx_ver acApp acDoc dbx object-list object-safe-array) (defun SS->OL (ss / i l) (setq i 0)(repeat (sslength ss)(setq l (cons (vlax-ename->vla-object (ssname ss i)) l) i (1+ i))) l) (defun dbx_ver ( / v) (strcat "objectdbx.axdbdocument" (if (< (setq v (atoi (getvar 'acadver))) 16) "" (strcat "." (itoa v))))) (setq acApp (vlax-get-acad-object) acDoc (vla-get-ActiveDocument acApp)) (setq dbx (vl-catch-all-apply 'vla-getinterfaceobject (list acApp (dbx_ver)))) (vla-open dbx dwg) ; put all block objects in a list (foreach object (ss->ol ss) (setq object-list (cons object object-list))) ; put list with objects in a safe array (setq object-safe-array (vlax-make-safearray vlax-vbobject (cons 0 (1- (length object-list))))) (vl-catch-all-apply 'vlax-safearray-fill (list object-safe-array object-list)) ; copy objects to wblock-dbx-container (vla-CopyObjects acDoc object-safe-array (vla-get-ModelSpace dbx)) (vl-catch-all-apply 'vla-saveas (list dbx dwg)) (vl-catch-all-apply 'vlax-release-object (list dbx)) (setq object-list nil object-safe-array nil) (princ) ) (defun c:t1 ( / ss dwg ) (if (and (setq ss (ssget))(setq dwg (getfiled "Copy objects to :" (getvar 'dwgprefix) "dwg" 0)))(ctd ss dwg))(princ)) maybe : ;;; copy to all open doc (defun ctaod ( / ss ss->ol dbx_ver acApp acDoc dbx object-list object-safe-array) (defun SS->OL (ss / i l) (setq i 0)(repeat (sslength ss)(setq l (cons (vlax-ename->vla-object (ssname ss i)) l) i (1+ i))) l) (defun dbx_ver ( / v) (strcat "objectdbx.axdbdocument" (if (< (setq v (atoi (getvar 'acadver))) 16) "" (strcat "." (itoa v))))) (setq acApp (vlax-get-acad-object) acDoc (vla-get-ActiveDocument acApp)) ;;; select objects (setq ss (ssget)) ; put all objects in a list (foreach object (ss->ol ss) (setq object-list (cons object object-list))) ; put list with objects in a safe array (setq object-safe-array (vlax-make-safearray vlax-vbobject (cons 0 (1- (length object-list))))) (vl-catch-all-apply 'vlax-safearray-fill (list object-safe-array object-list)) ;;; copy objects to all open docs except active doc (vlax-for x (vla-get-documents (vlax-get-acad-object)) (if (not (eq x acDoc)) (progn (vla-CopyObjects acDoc object-safe-array (vla-get-ModelSpace x)) (vla-save x) ) ) ) (princ) )
    1 point
×
×
  • Create New...