Jump to content

trying to get this lisp to work


andrew361

Recommended Posts

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)

)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

I tried the last and it works.

 

 

Here is the last modification.

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

Link to comment
Share on other sites

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