Lee Mac Posted November 30, 2014 Share Posted November 30, 2014 Hello Lee,I tried your lisp but I become only message like: Duplicate definition of block EF4318 ignored. Duplicate definition of block EP1780 ignored. Duplicate definition of block EP1781 ignored. This is to be expected - however, the program should still redefine the blocks as required. Quote Link to comment Share on other sites More sharing options...
francine2013 Posted March 5, 2015 Author Share Posted March 5, 2015 Hello Lee, With your help we daily use your lisp. Would it be possible to add a dcl dialog when a drawing is already open. The reason is if a drawing is open we have no visible return. Many thank Francine OB_IB.LSP Quote Link to comment Share on other sites More sharing options...
francine2013 Posted March 12, 2015 Author Share Posted March 12, 2015 Hello Lee, I found the solution I replaced: (princ (strcat "\n" src " is currently in use by " usr)) with (setq msg (strcat "\n" src " is currently in use by " usr)) (alert msg) I need your help on the two attached lisp. How can I put it together? With one lisp I can toogle the extension line (DIMSE) of a dimension and with the second I toggle the arrow (DIMBLK). XL-TOGL-DIMSE.lsp XL-TOGL-DIMBLK.lsp Quote Link to comment Share on other sites More sharing options...
francine2013 Posted October 4, 2016 Author Share Posted October 4, 2016 Hi Lee, I have to integrate a path variable (strcat (getenv "ACAD")), I tried to add that to the lisp but It doesnt work, can you help me please, (defun findblock ( dwg ) (vl-some '(lambda ( p ) (findfile (strcat p dwg))) '( "" "(strcat(getenv "YE_ACAD") "\\ArticleLibrary\\03-ScrewNailRivet\\DIN915\\")" "(strcat(getenv "YE_ACAD") "\\ArticleLibrary\\03-ScrewNailRivet\\DIN931\\")" ) ) ) Try the following instead: (defun c:openbl ( / blk lst src usr ) (cond ( (not (setq blk (selectblock "\nSelect block to open source drawing: ")))) ( (not (setq src (findblock (strcat blk ".dwg")))) (princ (strcat "\n" blk ".dwg not found.")) ) ( (progn (vlax-for doc (vla-get-documents (vlax-get-acad-object)) (setq lst (cons (cons (strcase (vla-get-fullname doc)) doc) lst)) ) (assoc (strcase src) lst) ) (vla-activate (cdr (assoc (strcase src) lst))) ) ( (setq usr (LM:dwgopen-p src)) (princ (strcat "\n" src " is currently in use by " usr)) ) ( (LM:open src)) ) (princ) ) (defun c:reinsertbl ( / blk src val var ) (cond ( (not (setq blk (selectblock "\nSelect block to redefine: ")))) ( (not (setq src (findblock (strcat blk ".dwg")))) (princ (strcat "\n" blk ".dwg not found.")) ) ( (setq var '(cmdecho regenmode) val (mapcar 'getvar var) ) (mapcar 'setvar var '(0 0)) (command "_.-insert" (strcat blk "=" src)) (mapcar 'setvar var val) ) ) (princ) ) (defun selectblock ( msg / enx obj rtn ) (while (progn (setvar 'errno 0) (setq obj (nentsel msg)) (cond ( (= 7 (getvar 'errno)) (princ "\nMissed, try again.") ) ( (null obj) nil) ( (and (/= "ATTRIB" (cdr (assoc 0 (setq enx (entget (car obj)))))) (= 2 (length obj)) ) (princ "\nSelected object is not a block.") ) ( (progn (if (= "ATTRIB" (cdr (assoc 0 enx))) (setq obj (cdr (assoc 330 enx))) (setq obj (car (last obj))) ) (vlax-property-available-p (setq obj (vlax-ename->vla-object obj)) 'effectivename) ) (null (setq rtn (vla-get-effectivename obj))) ) ( (null (setq rtn (vla-get-name obj)))) ) ) ) rtn ) (defun findblock ( dwg ) (vl-some '(lambda ( p ) (findfile (strcat p dwg))) '( "" "P:\\GBR_GreatBritain\\02-DESIGN\\02-05-BLOCKS\\Profiles\\" "P:\\GBR_GreatBritain\\02-DESIGN\\02-05-BLOCKS\\Gaskets\\" "P:\\GBR_GreatBritain\\02-DESIGN\\02-05-BLOCKS\\Castings\\" "P:\\GBR_GreatBritain\\02-DESIGN\\02-05-BLOCKS\\MouldingPieces\\" ) ) ) ;; Drawing Open-p - Lee Mac ;; Returns the owner of an open drawing, else nil if the drawing is unopen. ;; dwg - [str] Drawing filename (defun LM:dwgopen-p ( dwg / dwl tmp usr ) (if (and (setq dwl (findfile (strcat (substr dwg 1 (- (strlen dwg) 3)) "dwl"))) (null (vl-file-delete dwl)) ) (if (setq tmp (open dwl "r")) (progn (setq usr (read-line tmp) tmp (close tmp) ) usr ) "<Unknown>" ) ) ) ;; Open - Lee Mac ;; Uses the 'Open' method of the Shell Object to open the specified file or folder. ;; tar - [str/int] File, folder or ShellSpecialFolderConstants enum (defun LM:open ( tar / shl rtn ) (if (and (or (= 'int (type tar)) (setq tar (findfile tar))) (setq shl (vla-getInterfaceObject (vlax-get-acad-object) "shell.application")) ) (progn (setq rtn (vl-catch-all-apply 'vlax-invoke (list shl 'open tar))) (vlax-release-object shl) (not (vl-catch-all-error-p rtn)) ) ) ) (vl-load-com) (princ) I'm afraid I cannot advise regarding your paths - if the block cannot be found, the path must be incorrect. Lee Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 4, 2016 Share Posted October 4, 2016 Try the following: (defun findblock ( dwg / dir ) (setq dir (getenv "YE_ACAD")) (cond ( (findfile dwg)) ( (vl-some '(lambda ( p ) (findfile (strcat dir p dwg))) '( "\\ArticleLibrary\\03-ScrewNailRivet\\DIN915\\" "\\ArticleLibrary\\03-ScrewNailRivet\\DIN931\\" ) ) ) ) ) Quote Link to comment Share on other sites More sharing options...
francine2013 Posted October 4, 2016 Author Share Posted October 4, 2016 thank you so much for your help Lee it works perfect. I need also I new lisp or tool to annotate my drawing with balloon multileader, can I send the requirement directly to you to get a budget price? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 4, 2016 Share Posted October 4, 2016 thank you so much for your help Lee it works perfect. Excellent - you're welcome. I need also I new lisp or tool to annotate my drawing with balloon multileader, can I send the requirement directly to you to get a budget price? Certainly, feel free to drop me a message through my site. Quote Link to comment Share on other sites More sharing options...
francine2013 Posted October 6, 2016 Author Share Posted October 6, 2016 Hi Lee, Can I send my requirement to your email because I want to send some PDF and a lisp to explain what I need Quote Link to comment Share on other sites More sharing options...
francine2013 Posted October 6, 2016 Author Share Posted October 6, 2016 Hi Lee, I oder question about integration of a path variable in a text file .dat I changed this: "BALUSTRADE","G:\TE-Templates\01-AutoCADTemplates\CAD\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def","G:\TE-Templates\01-AutoCADTemplates\CAD\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def" to : "BALUSTRADE","%YE_ACAD%\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def","%YE_ACAD%\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def" It doesnt work Quote Link to comment Share on other sites More sharing options...
francine2013 Posted October 6, 2016 Author Share Posted October 6, 2016 I have add the lisp because I think that the lisp need some changes The Sel_Lib.txt is in reality Sel_Lib.dat file but I was not able to load. Hi Lee, I oder question about integration of a path variable in a text file .dat I changed this: "BALUSTRADE","G:\TE-Templates\01-AutoCADTemplates\CAD\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def","G:\TE-Templates\01-AutoCADTemplates\CAD\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def" to : "BALUSTRADE","%YE_ACAD%\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def","%YE_ACAD%\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def" It doesnt work Blk_Lib.dcl Blk_Lib-ALU.lsp Sel_Lib.txt Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 6, 2016 Share Posted October 6, 2016 Hi Lee, Can I send my requirement to your email because I want to send some PDF and a lisp to explain what I need Please send a message through my site and I will reply with my email address to which you may send your requirements. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 6, 2016 Share Posted October 6, 2016 I oder question about integration of a path variable in a text file .datI changed this: "BALUSTRADE","G:\TE-Templates\01-AutoCADTemplates\CAD\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def","G:\TE-Templates\01-AutoCADTemplates\CAD\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def" to : "BALUSTRADE","%YE_ACAD%\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def","%YE_ACAD%\ArticleLibrary\01-Profiles\Alu\Balustrade\Balustrade.def" It doesnt work Only specific Environment Variables are automatically recognised & expanded by Windows, arbitrary registry keys (such as those created by setenv) will not be recognised. You will need to either write a function to test for the occurrence of "%YE_ACAD%" within your path and perform the substitution, or concatenate this path when reading the file. Quote Link to comment Share on other sites More sharing options...
francine2013 Posted October 6, 2016 Author Share Posted October 6, 2016 Can you help me, I think the lisp "Blk_Lib-ALU" (send before) has to be modify by adding (getenv "YE_ACAD")) Only specific Environment Variables are automatically recognised & expanded by Windows, arbitrary registry keys (such as those created by setenv) will not be recognised. You will need to either write a function to test for the occurrence of "%YE_ACAD%" within your path and perform the substitution, or concatenate this path when reading the file. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 6, 2016 Share Posted October 6, 2016 Can you help me, I think the lisp "Blk_Lib-ALU" (send before) has to be modify by adding (getenv "YE_ACAD")) Consider the following function: (defun expandmyenvstr ( str / id1 id2 val ) (cond ( (not (wcmatch str "*%*?*%*")) str) ( (setq id1 (vl-string-position 37 str) id2 (vl-string-position 37 str (1+ id1)) val (getenv (substr str (+ id1 2) (- id2 id1 1))) ) (strcat (substr str 1 id1) val (expandmyenvstr (substr str (+ id2 2)))) ) ( (strcat (substr str 1 (1+ id2)) (expandmyenvstr (substr str (+ id2 2))))) ) ) _$ (setenv "YE_ACAD" "G:\\TE-Templates\\01-AutoCADTemplates\\CAD") "G:\\TE-Templates\\01-AutoCADTemplates\\CAD" _$ (expandmyenvstr "%YE_ACAD%\\ArticleLibrary\\01-Profiles\\Alu\\Balustrade\\Balustrade.def") "G:\\TE-Templates\\01-AutoCADTemplates\\CAD\\ArticleLibrary\\01-Profiles\\Alu\\Balustrade\\Balustrade.def" With multiple occurrences: _$ (expandmyenvstr "%YE_ACAD%\\ArticleLibrary\\01-Profiles\\Alu\\Balustrade\\Balustrade.def;%YE_ACAD%\\ArticleLibrary\\01-Profiles\\Alu\\Balustrade\\Balustrade.def") "G:\\TE-Templates\\01-AutoCADTemplates\\CAD\\ArticleLibrary\\01-Profiles\\Alu\\Balustrade\\Balustrade.def;G:\\TE-Templates\\01-AutoCADTemplates\\CAD\\ArticleLibrary\\01-Profiles\\Alu\\Balustrade\\Balustrade.def" Quote Link to comment Share on other sites More sharing options...
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.