Jump to content

Recommended Posts

Posted

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)

)

Posted
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)

)

 

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

Posted

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.

Posted

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

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

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

Posted

Could you post a drawing with the end result? this sounds alot like a dynamic block could do the trick.

Posted

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]

Posted

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

Posted

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

Posted

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

Posted

Maybe try it with a conditional instead of if.

Posted
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

 

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

Posted

I tried the last and it works.

Posted
I tried the last and it works.

 

 

Here is the last modification.

(SETQ NUM (getint "\n\Number of hots per Circuit "))

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