-
Compteur de contenus
6 374 -
Inscription
-
Dernière visite
-
Jours gagnés
30
Type de contenu
Profils
Forums
Calendrier
Blogs
Tout ce qui a été posté par Patrick_35
-
Salut Logiquement, dans Autocad, quand on dessine, c'est dans l'espace objet et non en papier. L'espace papier sert à la mise en page. @+
-
[CLOS] LISP IXL (Patrick_35) limité à 6 attributs
Patrick_35 a répondu à un(e) sujet de Clem81290 dans LISP et Visual LISP
Salut Tu n'as pas de limites. Si la cellule d'attribut (par exemple G10) est remplie, le lisp regarde si G11 et G12 sont vides. Oui, on passe au suivant. @+ -
Salut (defun c:imp(/ bck bg def doc ent hd lay lst pdf plt sel tot kill nombl mon_impression Mon_Cartouche) (defun kill(qui / item meth1 meth2 obj WMI) (setq WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil) meth2 (vlax-invoke meth1 'ExecQuery "Select * from Win32_Process") ) (vlax-for item meth2 (and (setq obj (vlax-get item 'CommandLine)) (vl-string-search (strcase qui) (strcase obj)) (vlax-invoke item 'Terminate) ) ) (foreach item (list WMI meth1 meth2) (vlax-release-object item) ) ) (defun nombl(bl) (if (vlax-property-available-p bl 'effectivename) (vla-get-effectivename bl) (vla-get-name bl) ) ) (defun mon_impression(dim) (if (> (distance (car dim) (list (caadr dim) (cadar dim) (caddar dim))) (distance (list (caadr dim) (cadar dim) (caddar dim)) (cadr dim)) ) (vla-put-plotrotation lay ac270degrees) (vla-put-plotrotation lay ac0degrees) ) (vlax-invoke lay 'setwindowtoplot (list (caar dim)(cadar dim)) (list (caadr dim)(cadadr dim)) ) (vl-catch-all-apply 'vlax-invoke (list plt 'plottodevice)) ) (setq doc (vla-get-activedocument (vlax-get-acad-object)) Mon_Cartouche "Cart" ; NOM DU CARTOUCHE ) (if (setq def (getenv "Patrick_35_imp")) (setq def (atoi def)) (setq def 1) ) (and (ssget "x" (list (cons 0 "insert") (cons 2 (strcat "`**," Mon_Cartouche)))) (progn (vlax-for ent (setq sel (vla-get-activeselectionset doc)) (and (eq (strcase (nombl ent)) (strcase Mon_Cartouche)) (progn (vla-getboundingbox ent 'bg 'hd) (setq lst (cons (list (vlax-safearray->list bg) (vlax-safearray->list hd)) lst)) ) ) ) (vla-delete sel) (cond ((eq (logand def 1) 1) (setq lst (vl-sort lst '(lambda(a B) (if (equal (cadar a) (cadar B) 0.0001) (< (caar a) (caar B)) (> (cadar a) (cadar B)) ) ) ) ) ) ((eq (logand def 2) 2) (setq lst (vl-sort lst '(lambda(a B) (if (equal (caar a) (caar B) 0.0001) (> (cadar a) (cadar B)) (< (caar a) (caar B)) ) ) ) ) ) ((eq (logand def 4) 4) (setq lst (vl-sort lst '(lambda(a B) (if (equal (cadar a) (cadar B) 0.0001) (< (caar a) (caar B)) (< (cadar a) (cadar B)) ) ) ) ) ) ((eq (logand def 8) 8) (setq lst (vl-sort lst '(lambda(a B) (if (equal (caar a) (caar B) 0.0001) (< (cadar a) (cadar B)) (< (caar a) (caar B)) ) ) ) ) ) ) (and (eq (logand def 16) 0) (kill "PDFCreator.exe")) (if (setq pdf (vlax-get-or-create-object "PDFCreator.clsPDFCreator")) (progn (vlax-invoke pdf 'cstart "/NoProcessingAtStartup") (vlax-put pdf 'cPrinterStop :vlax-false) (vlax-put pdf 'cPrinterStop :vlax-true) (vlax-put pdf 'cWindowState 0) (and (eq (logand def 16) 0) (vlax-invoke pdf 'cClearCache)) (vlax-put-property pdf 'cOption "savefilename" (vlax-make-variant (vl-filename-base (getvar "dwgname")))) (setq tot (vlax-get pdf 'count)) ) (progn (or (setq pdf2 (vlax-get-or-create-object "PDFCreatorBeta.JobQueue")) (setq pdf2 (vlax-get-or-create-object "PDFCreator.JobQueue")) ) (and (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list pdf2 'initialize))) (eq (logand def 16) 0) (progn (vlax-invoke pdf2 'releasecom) (vlax-invoke pdf2 'initialize) ) ) (setq tot (vlax-get pdf2 'count)) ) ) (setq lay (vla-get-activelayout doc) plt (vla-get-plot doc) ) (vla-put-configname lay "PDFCreator") (vla-refreshplotdeviceinfo lay) (vla-put-canonicalmedianame lay "A4") (vla-put-centerplot lay :vlax-true) (vla-put-paperunits lay acMillimeters) (vla-put-plothidden lay :vlax-false) (vlax-invoke lay 'setwindowtoplot '(0.0 0.0) '(10.0 10.0)) (vla-put-plotrotation lay ac270degrees) (vla-put-plottype lay acWindow) (vla-put-plotviewportborders lay :vlax-false) (vla-put-plotviewportsfirst lay :vlax-true) (vla-put-plotwithlineweights lay :vlax-true) (vla-put-plotwithplotstyles lay :vlax-true) (vla-put-scalelineweights lay :vlax-false) (vla-put-standardscale lay acVpScaleToFit) (vla-put-stylesheet lay "monochrome.ctb") (vla-put-usestandardscale lay :vlax-true) (and (vl-catch-all-error-p (setq bck (vl-catch-all-apply 'getvar (list "backgroundplot")))) (setq bck nil)) (and bck (setvar "backgroundplot" 0)) (foreach ent lst (mon_impression ent) (cond (pdf (while (/= (vlax-get pdf 'cCountOfPrintjobs) (1+ tot))) (setq tot (1+ tot)) ) (pdf2 (vlax-invoke-method pdf2 'waitforjobs (setq tot (1+ tot)) 10) ) ) ) (cond (pdf (and (eq (logand def 16) 0) (vlax-invoke pdf 'cCombineAll)) (vlax-release-object pdf) ) (pdf2 (and (eq (logand def 16) 0) (progn (vlax-invoke pdf2 'mergealljobs) (and (setq fic (getfiled "Nom du PDF" (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf") "PDF" 1)) (vlax-invoke (vlax-get pdf2 'nextjob) 'convertto fic) ) (vlax-invoke pdf2 'releasecom) ) ) (vlax-release-object pdf2) ) ) (and bck (setvar "backgroundplot" bck)) ) ) (princ) ) @+
-
Salut Je viens de voir le lisp. Bravo, difficile d'être plus clair. @+
-
Salut Il faut ajouter au lisp (ou taper directement au clavier) (vl-load-com) @+
-
Pour fonctionner sur des blocs dynamiques (defun c:imp(/ bck bg def doc ent hd lay lst pdf plt sel tot kill nombl mon_impression Mon_Cartouche) (defun kill(qui / item meth1 meth2 obj WMI) (setq WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil) meth2 (vlax-invoke meth1 'ExecQuery "Select * from Win32_Process") ) (vlax-for item meth2 (and (setq obj (vlax-get item 'CommandLine)) (vl-string-search (strcase qui) (strcase obj)) (vlax-invoke item 'Terminate) ) ) (foreach item (list WMI meth1 meth2) (vlax-release-object item) ) ) (defun nombl(bl) (if (vlax-property-available-p bl 'effectivename) (vla-get-effectivename bl) (vla-get-name bl) ) ) (defun mon_impression(dim) (vlax-invoke lay 'setwindowtoplot (list (caar dim)(cadar dim)) (list (caadr dim)(cadadr dim)) ) (vl-catch-all-apply 'vlax-invoke (list plt 'plottodevice)) ) (setq doc (vla-get-activedocument (vlax-get-acad-object)) Mon_Cartouche "Cart" ; NOM DU CARTOUCHE ) (if (setq def (getenv "Patrick_35_imp")) (setq def (atoi def)) (setq def 1) ) (and (ssget "x" (list (cons 0 "insert") (cons 2 (strcat "`**," Mon_Cartouche)))) (progn (vlax-for ent (setq sel (vla-get-activeselectionset doc)) (and (eq (strcase (nombl ent)) (strcase Mon_Cartouche)) (progn (vla-getboundingbox ent 'bg 'hd) (setq lst (cons (list (vlax-safearray->list bg) (vlax-safearray->list hd)) lst)) ) ) ) (vla-delete sel) (cond ((eq (logand def 1) 1) (setq lst (vl-sort lst '(lambda(a B) (if (equal (cadar a) (cadar B) 0.0001) (< (caar a) (caar B)) (> (cadar a) (cadar B)) ) ) ) ) ) ((eq (logand def 2) 2) (setq lst (vl-sort lst '(lambda(a B) (if (equal (caar a) (caar B) 0.0001) (> (cadar a) (cadar B)) (< (caar a) (caar B)) ) ) ) ) ) ((eq (logand def 4) 4) (setq lst (vl-sort lst '(lambda(a B) (if (equal (cadar a) (cadar B) 0.0001) (< (caar a) (caar B)) (< (cadar a) (cadar B)) ) ) ) ) ) ((eq (logand def 8) 8) (setq lst (vl-sort lst '(lambda(a B) (if (equal (caar a) (caar B) 0.0001) (< (cadar a) (cadar B)) (< (caar a) (caar B)) ) ) ) ) ) ) (and (eq (logand def 16) 0) (kill "PDFCreator.exe")) (if (setq pdf (vlax-get-or-create-object "PDFCreator.clsPDFCreator")) (progn (vlax-invoke pdf 'cstart "/NoProcessingAtStartup") (vlax-put pdf 'cPrinterStop :vlax-false) (vlax-put pdf 'cPrinterStop :vlax-true) (vlax-put pdf 'cWindowState 0) (and (eq (logand def 16) 0) (vlax-invoke pdf 'cClearCache)) (vlax-put-property pdf 'cOption "savefilename" (vlax-make-variant (vl-filename-base (getvar "dwgname")))) (setq tot (vlax-get pdf 'count)) ) (progn (or (setq pdf2 (vlax-get-or-create-object "PDFCreatorBeta.JobQueue")) (setq pdf2 (vlax-get-or-create-object "PDFCreator.JobQueue")) ) (and (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list pdf2 'initialize))) (eq (logand def 16) 0) (progn (vlax-invoke pdf2 'releasecom) (vlax-invoke pdf2 'initialize) ) ) (setq tot (vlax-get pdf2 'count)) ) ) (setq lay (vla-get-activelayout doc) plt (vla-get-plot doc) ) (vla-put-configname lay "PDFCreator") (vla-refreshplotdeviceinfo lay) (vla-put-canonicalmedianame lay "A4") (vla-put-centerplot lay :vlax-true) (vla-put-paperunits lay acMillimeters) (vla-put-plothidden lay :vlax-false) (vla-put-plotrotation lay ac270degrees) (vla-put-plottype lay acWindow) (vla-put-plotviewportborders lay :vlax-false) (vla-put-plotviewportsfirst lay :vlax-true) (vla-put-plotwithlineweights lay :vlax-true) (vla-put-plotwithplotstyles lay :vlax-true) (vla-put-scalelineweights lay :vlax-false) (vla-put-standardscale lay acVpScaleToFit) (vla-put-stylesheet lay "monochrome.ctb") (vla-put-usestandardscale lay :vlax-true) (and (vl-catch-all-error-p (setq bck (vl-catch-all-apply 'getvar (list "backgroundplot")))) (setq bck nil)) (and bck (setvar "backgroundplot" 0)) (foreach ent lst (mon_impression ent) (cond (pdf (while (/= (vlax-get pdf 'cCountOfPrintjobs) (1+ tot))) (setq tot (1+ tot)) ) (pdf2 (vlax-invoke-method pdf2 'waitforjobs (setq tot (1+ tot)) 10) ) ) ) (cond (pdf (and (eq (logand def 16) 0) (vlax-invoke pdf 'cCombineAll)) (vlax-release-object pdf) ) (pdf2 (and (eq (logand def 16) 0) (progn (vlax-invoke pdf2 'mergealljobs) (and (setq fic (getfiled "Nom du PDF" (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf") "PDF" 1)) (vlax-invoke (vlax-get pdf2 'nextjob) 'convertto fic) ) (vlax-invoke pdf2 'releasecom) ) ) (vlax-release-object pdf2) ) ) (and bck (setvar "backgroundplot" bck)) ) ) (princ) ) @+
-
Salut Le lisp modifié Pour les impressions (defun c:imp(/ bck bg def doc ent hd lay lst pdf plt sel tot kill mon_impression Mon_Cartouche) (defun kill(qui / item meth1 meth2 obj WMI) (setq WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil) meth2 (vlax-invoke meth1 'ExecQuery "Select * from Win32_Process") ) (vlax-for item meth2 (and (setq obj (vlax-get item 'CommandLine)) (vl-string-search (strcase qui) (strcase obj)) (vlax-invoke item 'Terminate) ) ) (foreach item (list WMI meth1 meth2) (vlax-release-object item) ) ) (defun mon_impression(dim) (vlax-invoke lay 'setwindowtoplot (list (caar dim)(cadar dim)) (list (caadr dim)(cadadr dim)) ) (vl-catch-all-apply 'vlax-invoke (list plt 'plottodevice)) ) (setq doc (vla-get-activedocument (vlax-get-acad-object)) Mon_Cartouche "Cart" ; NOM DU CARTOUCHE ) (if (setq def (getenv "Patrick_35_imp")) (setq def (atoi def)) (setq def 1) ) (and (ssget "x" (list (cons 0 "insert") (cons 2 Mon_Cartouche))) (progn (vlax-for ent (setq sel (vla-get-activeselectionset doc)) (vla-getboundingbox ent 'bg 'hd) (setq lst (cons (list (vlax-safearray->list bg) (vlax-safearray->list hd)) lst)) ) (vla-delete sel) (cond ((eq (logand def 1) 1) (setq lst (vl-sort lst '(lambda(a B) (if (equal (cadar a) (cadar B) 0.0001) (< (caar a) (caar B)) (> (cadar a) (cadar B)) ) ) ) ) ) ((eq (logand def 2) 2) (setq lst (vl-sort lst '(lambda(a B) (if (equal (caar a) (caar B) 0.0001) (> (cadar a) (cadar B)) (< (caar a) (caar B)) ) ) ) ) ) ((eq (logand def 4) 4) (setq lst (vl-sort lst '(lambda(a B) (if (equal (cadar a) (cadar B) 0.0001) (< (caar a) (caar B)) (< (cadar a) (cadar B)) ) ) ) ) ) ((eq (logand def 8) 8) (setq lst (vl-sort lst '(lambda(a B) (if (equal (caar a) (caar B) 0.0001) (< (cadar a) (cadar B)) (< (caar a) (caar B)) ) ) ) ) ) ) (and (eq (logand def 16) 0) (kill "PDFCreator.exe")) (if (setq pdf (vlax-get-or-create-object "PDFCreator.clsPDFCreator")) (progn (vlax-invoke pdf 'cstart "/NoProcessingAtStartup") (vlax-put pdf 'cPrinterStop :vlax-false) (vlax-put pdf 'cPrinterStop :vlax-true) (vlax-put pdf 'cWindowState 0) (and (eq (logand def 16) 0) (vlax-invoke pdf 'cClearCache)) (vlax-put-property pdf 'cOption "savefilename" (vlax-make-variant (vl-filename-base (getvar "dwgname")))) (setq tot (vlax-get pdf 'count)) ) (progn (or (setq pdf2 (vlax-get-or-create-object "PDFCreatorBeta.JobQueue")) (setq pdf2 (vlax-get-or-create-object "PDFCreator.JobQueue")) ) (and (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list pdf2 'initialize))) (eq (logand def 16) 0) (progn (vlax-invoke pdf2 'releasecom) (vlax-invoke pdf2 'initialize) ) ) (setq tot (vlax-get pdf2 'count)) ) ) (setq lay (vla-get-activelayout doc) plt (vla-get-plot doc) ) (vla-put-configname lay "PDFCreator") (vla-refreshplotdeviceinfo lay) (vla-put-canonicalmedianame lay "A4") (vla-put-centerplot lay :vlax-true) (vla-put-paperunits lay acMillimeters) (vla-put-plothidden lay :vlax-false) (vla-put-plotrotation lay ac270degrees) (vla-put-plottype lay acWindow) (vla-put-plotviewportborders lay :vlax-false) (vla-put-plotviewportsfirst lay :vlax-true) (vla-put-plotwithlineweights lay :vlax-true) (vla-put-plotwithplotstyles lay :vlax-true) (vla-put-scalelineweights lay :vlax-false) (vla-put-standardscale lay acVpScaleToFit) (vla-put-stylesheet lay "monochrome.ctb") (vla-put-usestandardscale lay :vlax-true) (and (vl-catch-all-error-p (setq bck (vl-catch-all-apply 'getvar (list "backgroundplot")))) (setq bck nil)) (and bck (setvar "backgroundplot" 0)) (foreach ent lst (mon_impression ent) (cond (pdf (while (/= (vlax-get pdf 'cCountOfPrintjobs) (1+ tot))) (setq tot (1+ tot)) ) (pdf2 (vlax-invoke-method pdf2 'waitforjobs (setq tot (1+ tot)) 10) ) ) ) (cond (pdf (and (eq (logand def 16) 0) (vlax-invoke pdf 'cCombineAll)) (vlax-release-object pdf) ) (pdf2 (and (eq (logand def 16) 0) (progn (vlax-invoke pdf2 'mergealljobs) (and (setq fic (getfiled "Nom du PDF" (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf") "PDF" 1)) (vlax-invoke (vlax-get pdf2 'nextjob) 'convertto fic) ) (vlax-invoke pdf2 'releasecom) ) ) (vlax-release-object pdf2) ) ) (and bck (setvar "backgroundplot" bck)) ) ) (princ) ) Pour les Options (defun c:impo(/ chx def doc) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) (if (setq def (getenv "Patrick_35_imp")) (setq def (atoi def)) (setq def 1) ) (princ "\nValeurs pour l'impression des pdf : ") (princ "\n\t\t 1 : Départ en Haut à Gauche, puis vers la Droite") (princ "\n\t\t 2 : Départ en Haut à Gauche, puis vers le Bas") (princ "\n\t\t 4 : Départ en Bas à Gauche, puis vers la Droite") (princ "\n\t\t 8 : Départ en Bas à Gauche, puis vers le Haut") (princ "\n\t\t 16 : Ne pas fusionner les pdf") (initget 6) (setq chx (getint (strcat "\nOptions des pdf <" (itoa def) "> : "))) (and chx (/= chx def) (vl-position (rem chx 16) '(1 2 4 8)) (setenv "Patrick_35_imp" (itoa chx)) ) (vla-endundomark doc) (princ) ) Et pour fusionner les pdf si besoin (defun c:impf(/ pdf2) (or (setq pdf2 (vlax-get-or-create-object "PDFCreatorBeta.JobQueue")) (setq pdf2 (vlax-get-or-create-object "PDFCreator.JobQueue")) ) (and (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list pdf2 'initialize))) (> (vlax-get pdf2 'count) 0) (progn (vlax-invoke pdf2 'mergealljobs) (and (setq fic (getfiled "Nom du PDF" (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf") "PDF" 1)) (vlax-invoke (vlax-get pdf2 'nextjob) 'convertto fic) ) (vlax-invoke pdf2 'releasecom) ) ) (vlax-release-object pdf2) (princ) ) ps : Tu peux additionner les options (par exemple 1 + 16 = 17, mais pas 1 + 2 = dernière option) @+
-
Salut Il faut que tu remplaces les cadres des folios (qui sont en polylignes) par un bloc (nommé "Cart" dans le lisp) afin de reconnaitre tous les folios (defun c:imp(/ bck bg doc ent hd lay lst pdf plt sel tot kill mon_impression Mon_Cartouche) (defun kill(qui / item meth1 meth2 obj WMI) (setq WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil) meth2 (vlax-invoke meth1 'ExecQuery "Select * from Win32_Process") ) (vlax-for item meth2 (and (setq obj (vlax-get item 'CommandLine)) (vl-string-search (strcase qui) (strcase obj)) (vlax-invoke item 'Terminate) ) ) (foreach item (list WMI meth1 meth2) (vlax-release-object item) ) ) (defun mon_impression(dim) (vlax-invoke lay 'setwindowtoplot (list (caar dim)(cadar dim)) (list (caadr dim)(cadadr dim)) ) (vl-catch-all-apply 'vlax-invoke (list plt 'plottodevice)) ) (setq doc (vla-get-activedocument (vlax-get-acad-object)) Mon_Cartouche "Cart" ; NOM DU CARTOUCHE ) (and (ssget "x" (list (cons 0 "insert") (cons 2 Mon_Cartouche))) (progn (vlax-for ent (setq sel (vla-get-activeselectionset doc)) (vla-getboundingbox ent 'bg 'hd) (setq lst (cons (list (vlax-safearray->list bg) (vlax-safearray->list hd)) lst)) ) (vla-delete sel) (setq lst (vl-sort lst '(lambda(a B) (if (equal (cadar a) (cadar B) 0.0001) (< (caar a) (caar B)) (> (cadar a) (cadar B)) ) ) ) ) (kill "PDFCreator.exe") (if (setq pdf (vlax-get-or-create-object "PDFCreator.clsPDFCreator")) (progn (vlax-invoke pdf 'cstart "/NoProcessingAtStartup") (vlax-put pdf 'cPrinterStop :vlax-false) (vlax-put pdf 'cPrinterStop :vlax-true) (vlax-put pdf 'cWindowState 0) (vlax-invoke pdf 'cClearCache) (vlax-put-property pdf 'cOption "savefilename" (vlax-make-variant (vl-filename-base (getvar "dwgname")))) ) (progn (or (setq pdf2 (vlax-get-or-create-object "PDFCreatorBeta.JobQueue")) (setq pdf2 (vlax-get-or-create-object "PDFCreator.JobQueue")) ) (if (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list pdf2 'initialize))) (progn (vlax-invoke pdf2 'releasecom) (vlax-invoke pdf2 'initialize) ) ) ) ) (setq lay (vla-get-activelayout doc) plt (vla-get-plot doc) tot 0 ) (vla-put-configname lay "PDFCreator") (vla-refreshplotdeviceinfo lay) (vla-put-canonicalmedianame lay "A4") (vla-put-centerplot lay :vlax-true) (vla-put-paperunits lay acMillimeters) (vla-put-plothidden lay :vlax-false) (vla-put-plotrotation lay ac90degrees) (vla-put-plottype lay acWindow) (vla-put-plotviewportborders lay :vlax-false) (vla-put-plotviewportsfirst lay :vlax-true) (vla-put-plotwithlineweights lay :vlax-true) (vla-put-plotwithplotstyles lay :vlax-true) (vla-put-scalelineweights lay :vlax-false) (vla-put-standardscale lay acVpScaleToFit) (vla-put-stylesheet lay "monochrome.ctb") (vla-put-usestandardscale lay :vlax-true) (if (vl-catch-all-error-p (setq bck (vl-catch-all-apply 'getvar (list "backgroundplot")))) (setq bck nil) ) (if bck (setvar "backgroundplot" 0) ) (foreach ent lst (mon_impression ent) (cond (pdf (while (/= (vlax-get pdf 'cCountOfPrintjobs) (1+ tot))) (setq tot (1+ tot)) ) (pdf2 (vlax-invoke-method pdf2 'waitforjobs (setq tot (1+ tot)) 10) ) ) ) (cond (pdf (vlax-invoke pdf 'cCombineAll) (vlax-release-object pdf) ) (pdf2 (vlax-invoke pdf2 'mergealljobs) (and (setq fic (getfiled "Nom du PDF" (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf") "PDF" 1)) (vlax-invoke (vlax-get pdf2 'nextjob) 'convertto fic) ) (vlax-invoke pdf2 'releasecom) (vlax-release-object pdf2) ) ) (if bck (setvar "backgroundplot" bck) ) ) ) (princ) ) @+
-
Si tu as un exemple (juste les cadres avec un n°) je mettrai le lisp à jour @+
-
Salut Vous avez aussi ce sujet pour imprimer des folios qui sont dans l'espace objet. @+
-
Salut Faire une mise en page est quand même très rapide, et utiliser ensuite MPL évite de tout refaire. De plus, tu peux aussi importer une mise en page avec Autocad. Ta demande porte aujourd'hui que sur quelques éléments, mais demain ? Si c'est ce que tu souhaites quand même faire, et bien c'est l'occasion de se mettre au lisp et au Forum de t'aider si besoin. @+
-
Salut Tu as aussi MPL Il recopie les mises en pages d'une présentation @+
-
[Résolu] Modifier des attributs de blocs dans les espaces papiers
Patrick_35 a répondu à un(e) sujet de zza427 dans AutoCAD 2015
Bonjour La manip qu'indique zebulon_ fonctionne, mais avec la commande _filter (ou filtrer en français). Par contre, avec _selectrap, cela ne fonctionne que sur l'espace courant. @+ -
Revenir en arrière sur un enregistrement
Patrick_35 a répondu à un(e) sujet de FormaBois dans AutoCAD LT 2014
Salut Tu as deux possibilités. 1) Renommer le fichier .bak en .dwg 2) Aller dans le répertoire des sauvegardes automatiques (chemin qu'on retrouve dans les options) et renommer les .sv$ @+ -
[Résolu] Modifier des attributs de blocs dans les espaces papiers
Patrick_35 a répondu à un(e) sujet de zza427 dans AutoCAD 2015
Salut Avec MAT ? @+ -
Mieux qu'un long discours. Sélectionnes plusieurs blocs. (defun c:InfoBloc(/ doc) (setq doc (vla-get-activedocument (vlax-get-acad-object)) tot 0 ) (vla-startundomark doc) (and (ssget (list (cons 0 "insert"))) (progn (vlax-for ent (setq sel (vla-get-activeselectionset doc)) (terpri) (princ ent) (princ " - ") (princ "Bloc n°") (princ (setq tot (1+ tot))) ) (vla-delete sel) ) ) (vla-endundomark doc) (princ) ) @+
-
Salut Je ne sais pas comment tu souhaites traiter les données, mais tu peux dans un 1er temps inclure les résultats (tous les princ ...) dans la boucle. @+
-
La boucle, tu l'as déjà. Un ssget permet la sélection de plusieurs objets. @+
-
Pour ça, il n'y a jamais de problèmes B) Sauf que les belges ont été voir les allemands pour alléger leurs bières, mais bon. Il y a plusieurs pays qui savent brasser, même en France et en Bretagne :) @+
-
Par exemple Je lance la ligne de code de sélection et je choisis 2 blocs. (ssget (list (cons 0 "insert"))) Et on retrouve le jeu de sélection ici (setq sel (vla-get-activeselectionset doc)) Si je traduis "vla-get-activeselectionset" vla --> fonction vlisp get --> lire, contraire de put = écrire active --> active ou actuelle selection --> sélection set --> Ensemble ou collection Pour connaitre le nombre de blocs sélectionnés (vla-get-count sel) Pour trouver le 1er bloc sélectionné (vla-item sel 0) Et donc, pour parcourir la sélection (vlax-for ent sel ...) Et pour terminer, effacer le jeu de sélection pour éviter de futures erreurs de sélections (vla-delete sel) @+
-
Ben, tu sais ce qu'il te reste à faire ;) Je suis certain qu'il y a d'autres domaines De rien, je ne suis pas contre une bière :D @+
-
Le lisp modifié pour répondre à ta demande (defun c:BNameLabel (/ ent entl obj) (cond ((not (setq ent (car (entsel "\nSelect block: "))))) ((not (eq (cdr (assoc 0 (entget ent))) "INSERT")) (princ "\nInvalid object!")) ((setq pt (getpoint "\nSpecify first point: ")) (setq entl (entlast)) (setq att (vl-remove-if-not '(lambda(x)(eq (strcase (vla-get-tagstring x)) "REPERE")) (vlax-invoke (vlax-ename->vla-object ent) 'getattributes))) (vl-cmdf "_.mleader" "_non" pt "\\") (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (vl-cmdf "")) (if (not (equal entl (setq entl (entlast)))) (vla-put-textstring (vlax-ename->vla-object entl) (vla-get-textstring (car att))) ) ) ) (princ) ) Mais je ne comprends pas. Celui que je t'ai donné devrait fonctionner ? @+
-
Salut J'ai un peu modifié ton lisp afin de te montrer une bloucle en vl, éviter les vlax-ename->vla-object et les vlax-variant-value (defun c:InfoBloc(/ doc) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) (prompt "\nCLIQUEz SUR LE BLOC :") (and (ssget (list (cons 0 "insert"))) (progn (vlax-for ent (setq sel (vla-get-activeselectionset doc)) (foreach prop (vlax-invoke ent 'getdynamicblockproperties) (and (= (vla-get-propertyname prop) "Visibilité1") (setq ValeureExtraite (vlax-get prop 'value)) ) ) ) (vla-delete sel) (princ (strcat "\n...Données extraites :")) (princ "\n...") (princ (strcat "\n...Type de Câble.... : " ValeureExtraite)) (princ "\n...") ) ) (vla-endundomark doc) (princ) ) Pour récuperer les valeurs d'attibuts, utilises (vlax-invoke ent 'getattributes) dans la boucle vlax-for @+
-
Salut Le lisp corrigé (defun c:atm(/ att doc ent grr new pt1 pt2 mlead) (defun mlead(pt2 / pts) (setq pt2 (list (car pt2) (cadr pt2) (caddr pt1)) pts (append (trans pt1 1 0) (trans pt2 1 0)) ) (if new (progn (vlax-invoke new 'setleaderlinevertices 0 pts) (vla-setdoglegdirection new 0 (vlax-3D-point (trans (list (if (> (car pt2) (car pt1)) 1 -1) 0 0) 1 0 T))) (vla-update new) ) (progn (setq new (vlax-invoke (vla-get-modelspace doc) 'addmleader pts 0)) (vla-put-textstring new att) (vla-rotate new (vlax-3d-point (trans pt2 1 0)) (angle (trans '(0 0 0) 1 0) (trans '(1 0 0) 1 0)) ) (setq pts (vlax-invoke new 'getleaderlinevertices 0)) (vlax-invoke new 'move (trans (list 0.0 0.0 (last pts)) 1 0) (trans (list 0.0 0.0 (caddr pt2)) 1 0) ) ) ) ) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) (while (setq ent (entsel "\nSélectionnez un bloc : ")) (and (setq ent (vlax-ename->vla-object (car ent))) (eq (vla-get-objectname ent) "AcDbBlockReference") (eq (vla-get-hasattributes ent) :vlax-true) (setq att (vl-remove-if-not '(lambda(x)(eq (strcase (vla-get-tagstring x)) "REPERE")) (vlax-invoke ent 'getattributes))) (setq att (vla-get-textstring (car att))) (setq pt1 (getpoint "\n1er point : ")) (setq new nil pt2 pt1) (princ "\n2em point : ") (while (and pt2 (setq grr (grread t 9 0)) (vl-position (car grr) '(2 3 5)) ) (cond ((= (car grr) 3)(setq pt2 nil)) ((= (car grr) 5)(mlead (cadr grr))) (T (setq pt2 nil)(if new (vla-delete new))) ) ) ) ) (vla-endundomark doc) (princ) ) @+
-
Ok, j'ai compris. C'est le Z qui reste à 0 malgré les bonnes coordonnées. Reste à comprendre pourquoi. @+
