andrew361 Posted June 26, 2009 Share Posted June 26, 2009 i created this lisp file to insert ground, hot, nuetral blocks and others but can't seem to get it to work correctly, any suggestions would help thanks Code: (defun c:HRtest () (command "-layer" "s" "ee-wire" "") (command "LINE" pause pause "") (command "insert" "z:/details/nrg/elec/blocks/arrowh" pause "1" "1" pause) (SETQ NUM (- (getint "\n\Number of hots per Circuit ") 1)) (if 1 (= num 1) (command "insert" "z:/details/nrg/elec/blocks/_elec_ghn" pause "1" "1" pause) ) (if 2 (= num 2) (command "insert" "z:/details/nrg/elec/blocks/_elec_ghhn" pause "1" "1" pause) ) (command "-layer" "s" "ee-text" "") (command "mtext" pause ) out (close out) ) Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 i created this lisp file to insert ground, hot, nuetral blocks and others but can't seem to get it to work correctly, any suggestions would helpthanks Code: (defun c:HRtest () (command "-layer" "s" "ee-wire" "") (command "LINE" pause pause "") (command "insert" "z:/details/nrg/elec/blocks/arrowh" pause "1" "1" pause) (SETQ NUM (- (getint "\n\Number of hots per Circuit ") 1)) (if 1 (= num 1) (command "insert" "z:/details/nrg/elec/blocks/_elec_ghn" pause "1" "1" pause) ) (if 2 (= num 2) (command "insert" "z:/details/nrg/elec/blocks/_elec_ghhn" pause "1" "1" pause) ) (command "-layer" "s" "ee-text" "") (command "mtext" pause ) out (close out) ) In the first place you are trying to set a layer, So the layer needs to be there to get past that part. Try making the layer instead. The program is also searching for blocks. You did not upload them so I cannot test from there as the program stop at that point. Please supply the blocks need for the program so it can be tested. Thanks, The Buzzard Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 Also please elaborate on the specific problem you are having so we know what to look for. This would be a big help as well. Quote Link to comment Share on other sites More sharing options...
andrew361 Posted June 26, 2009 Author Share Posted June 26, 2009 i do have my layers setup and the whole routine runs but when is asks how many hots per circuit and you hit 1 or 2 which are the only two block loaded it does not bring the block in instead it goes straight to mtext _ELEC_GHN.dwg _ELEC_GHHN.dwg Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 i do have my layers setup and the whole routine runs but when is asks how many hots per circuit and you hit 1 or 2 which are the only two block loaded it does not bring the block in instead it goes straight to mtext Your missing one called (arrowh). Can you attach it? Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 Your missing one called (arrowh). Can you attach it? (defun c:HRtest () (command "-layer" "m" "ee-wire" "") (command "LINE" pause pause "") (command "insert" "z:[color=red]//[/color]details[color=red]//[/color]nrg[color=red]//[/color]elec[color=red]//[/color]blocks[color=red]//[/color]arrowh" pause "1" "1" pause) (SETQ NUM (- (getint "\n\Number of hots per Circuit ") 1)) (if 1 (= num 1) (command "insert" "z:[color=red]//[/color]details[color=red]//[/color]nrg[color=red]//[/color]elec[color=red]//[/color]blocks[color=red]//[/color]_elec_ghn" pause "1" "1" pause) ) (if 2 (= num 2) (command "insert" "z:[color=red]//[/color]details[color=red]//[/color]nrg[color=red]//[/color]elec[color=red]//[/color]blocks[color=red]//[/color]_elec_ghhn" pause "1" "1" pause) ) (command "-layer" "s" "ee-text" "") (command "mtext" pause ) out (close out) ) I think you need to use double slash marks on your path ( //) Give that a try. Quote Link to comment Share on other sites More sharing options...
andrew361 Posted June 26, 2009 Author Share Posted June 26, 2009 attached is arrowh block, sorry ARROWH.dwg Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 26, 2009 Share Posted June 26, 2009 Could you post a drawing with the end result? this sounds alot like a dynamic block could do the trick. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 Also remove this slash in the prompt. [/color] [color=black](defun c:HRtest[/color] [color=black](command "-layer" "m" "ee-wire" "")[/color] [color=black](command "LINE" pause pause "")[/color] [color=black](command "insert" "z://details//nrg//elec//blocks//arrowh" pause "1" "1" pause)[/color] [color=black](SETQ NUM (- (getint "\n[color=red]\[/color]Number of hots per Circuit ") 1)) (if 1 (= num 1) (command "insert" "z://details//nrg//elec//blocks//_elec_ghn" pause "1" "1" pause) ) (if 2 (= num 2) (command "insert" "z://details//nrg//elec//blocks//_elec_ghhn" pause "1" "1" pause) ) (command "-layer" "s" "ee-text" "") (command "mtext" pause ) out (close out) )[/color] Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 I modified the code since I was not going to create all those directories. You also had a 1 & 2 after (if 1 (= NUM 1) (if 2 (= NUM 2) I removed those and it worked. (defun c:HRtest () (command "-layer" "m" "ee-wire" "") (command "LINE" pause pause "") (command "insert" "arrowh" pause "1" "1" pause) (SETQ NUM (- (getint "\nNumber of hots per Circuit ") 1)) (if (= NUM 1) (command "insert" "_elec_ghn" pause "1" "1" pause) ) (if (= NUM 2) (command "insert" "_elec_ghhn" pause "1" "1" pause) ) (command "-layer" "m" "ee-text" "") (command "mtext" pause ) out (close out) ) Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 OK I put the directories in on I have a C: drive. I kept the slashes to one / as shown. Removed the extra 1 & 2 as mentioned in the previous post. Please compare with your code. This works fine. (defun c:HRtest () (command "-layer" "s" "ee-wire" "") (command "LINE" pause pause "") (command "insert" "c:/details/nrg/elec/blocks/arrowh" pause "1" "1" pause) (SETQ NUM (- (getint "\n\Number of hots per Circuit ") 1)) (if (= NUM 1) (command "insert" "z:/details/nrg/elec/blocks/_elec_ghn" pause "1" "1" pause) ) (if (= NUM 2) (command "insert" "z:/details/nrg/elec/blocks/_elec_ghhn" pause "1" "1" pause) ) (command "-layer" "s" "ee-text" "") (command "mtext" pause ) out (close out) ) Quote Link to comment Share on other sites More sharing options...
andrew361 Posted June 26, 2009 Author Share Posted June 26, 2009 buzzard lisp works only if you type 2, but it doesn't bring in the correct block for number 2. And if you try 1 it doesn't work Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 Maybe try it with a conditional instead of if. Quote Link to comment Share on other sites More sharing options...
andrew361 Posted June 26, 2009 Author Share Posted June 26, 2009 this is what it supposed to look like look like this.dwg Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 buzzardlisp works only if you type 2, but it doesn't bring in the correct block for number 2. And if you try 1 it doesn't work Try this instead. (defun c:HRtest () (command "-layer" "s" "ee-wire" "") (command "LINE" pause pause "") (command "insert" "c:/details/nrg/elec/blocks/arrowh" pause "1" "1" pause) (SETQ NUM (getint "\n\Number of hots per Circuit ")) (if (= NUM 1) (command "insert" "z:/details/nrg/elec/blocks/_elec_ghn" pause "1" "1" pause) ) (if (= NUM 2) (command "insert" "z:/details/nrg/elec/blocks/_elec_ghhn" pause "1" "1" pause) ) (command "-layer" "s" "ee-text" "") (command "mtext" pause ) out (close out) ) Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 I tried the last and it works. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 26, 2009 Share Posted June 26, 2009 I tried the last and it works. Here is the last modification. (SETQ NUM (getint "\n\Number of hots per Circuit ")) 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.