Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Routines failing after working for a while- HVAC

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
293 Views, 4 Replies

Routines failing after working for a while- HVAC

I'm pretty new to autolisp and I have been trying to write some routines for a while but am constantly running into the same problem. I don't have visual lisp because I am on a mac and I test my routines by just copying them to the command line. It works most of the time but it seems that they just all of a sudden stop working, for example this routine was meant to add a corner to a duct and works fine:

 

(defun C:Corner()
(setq usersnap (getvar "osmode"))
(setq userorth (getvar "orthomode"))
(setvar "osmode" 129)
(setvar "orthomode" 0)
(setq a (getpoint "Select Outside Point"))
(setq b (getpoint "Select Inside Point"))
(setq dst1 (distance a b))
(setq ang1 (angle a b))
(setq mpt1 (polar a ang1 (/ dst1 2)))
(setvar "osmode" 130)
(setq dir (getpoint "Select Point Perpendicular to Midpoint"))
(setq dang (angle mpt1 dir))
(setvar "osmode" 0)
(setq outcor (polar a dang (* dst1 1.25)))
(setq incor (polar b dang (* dst1 0.25)))
(setq c (polar outcor ang1 (* dst1 1.25)))
(setq d (polar incor ang1 (* dst1 0.25)))
(command "line" a outcor c d incor b "")

)

 

 

However when I try to add on to it or change it at all, like by adding this which will be used later, it doesn't work

 

 

(defun C:Corner()
(setq usersnap (getvar "osmode"))
(setq userorth (getvar "orthomode"))
(setvar "osmode" 129)
(setvar "orthomode" 0)
(setq a (getpoint "Select Outside Point"))
(setq b (getpoint "Select Inside Point"))
(setq dst1 (distance a b))
(setq ang1 (angle a b))
(setq mpt1 (polar a ang1 (/ dst1 2)))
(setvar "osmode" 130)
(setq dir (getpoint "Select Point Perpendicular to Midpoint"))

(setq vane (getstring "vanes y or n"))
(setq dang (angle mpt1 dir))
(setvar "osmode" 0)
(setq outcor (polar a dang (* dst1 1.25)))
(setq incor (polar b dang (* dst1 0.25)))
(setq c (polar outcor ang1 (* dst1 1.25)))
(setq d (polar incor ang1 (* dst1 0.25)))
(command "line" a outcor c d incor b "")

)

 

 

I get all sorts of errors, most of them just seem like its not interpreting correctly, like ill have (command "line" something...) and it will say unknown command "MMAND"

It happens with literally everything I write, is it something with copying and pasting to the command line? or Fraise? 

4 REPLIES 4
Message 2 of 5
Shneuph
in reply to: Anonymous

Are you using an ASCII editor for your text?  I know sometimes the " (quotation marks especially) can be a problem if they are not done in the right text editor.  I'd check this first.

 

https://discussions.apple.com/message/5014223

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 3 of 5
Anonymous
in reply to: Shneuph

I don't believe that's causing the problem, I'm using Fraise and from what I've read it is pretty basic text and should be working, also the codes seem to be failing at very random spots, not necessarily just around quotations. For example, it very often just cuts off words and says unknown command, later in the code it uses the variable vane21 and it spits out unknown command "ane21" It is spelled correctly in every instance.

Message 4 of 5
Shneuph
in reply to: Anonymous

If you save the ASCII files as .lsp and then load them using appload do they still error out?

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 5 of 5
Anonymous
in reply to: Shneuph

That did the trick, thank you so much

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost