Jump to content

Recommended Posts

Posted

This is basicaly a lisp that creates a circle at a scaled radius to the original number I enter. That constant im using is the number you would use if you want to dimension a isometric 2d object. Because an iso image cannot be scaled at a 1:1 scale. I use this lisp to draw isometric objects correctly.

 

 

(defun c:isoc (/ ic sd)

(initget 6)
(cond
    (setq ic (strcat "\nEnter Length ""))
     (setq ic)
)
(setq sd (ic * .816496581))
    
(command "circle" getvar(sd))
(princ)
)




Posted
Try

 

(* Ic 0.8.... )

 

 

Im just getting "unknown command"

Posted
This is basicaly a lisp that creates a circle at a scaled radius to the original number I enter. That constant im using is the number you would use if you want to dimension a isometric 2d object. Because an iso image cannot be scaled at a 1:1 scale. I use this lisp to draw isometric objects correctly.

 

 

(defun c:isoc (/ ic sd)

(initget 6)
(cond
    (setq ic ([color=Red]strcat[/color] "\nEnter Length [color=Red]""[/color]))
     (setq ic)
)
(setq sd ([color=Red]ic * .816496581[/color]))
    
(command "circle" [color=Red]getvar(sd)[/color])
(princ)
)




 

These above red are a few of your other problems. Perhaps start with the following code and add your desired initget functions to it. You need to decide for yourself how you want to execute the circle command in the correct fashion.

 

(defun c:isoc (/ ic sd)
(setq ic (getint "\nEnter Length "))
(setq sd (* ic 0.816496581))
    
(command "circle" (getpoint "\nCenter: ") sd)
(princ)
)

Posted

"What am I doing wrong here?..."

 

I think the converse is easier to answer...

  • You have an incorrect number of quote marks making your String.
  • Your COND statement is missing quite a few brackets
  • Your second condition in your COND statement has a "setq" without a value argument.
  • Your Getvar statement is incorrect.
  • Your multiplication is wrong.

Posted

Here are the mistakes highlighted:

 

(defun c:isoc (/ ic sd)

(initget 6)
(cond
    [b][color=Red]([/color][/b]setq ic ([b][color=Red]strcat[/color][/b] "\nEnter Length [b][color=Red]""[/color][/b]))
     [b][color=Red](setq ic)[/color][/b]
)
(setq sd (ic [color=Red][b]*[/b][/color] [color=Red][b].816496581[/b][/color]))
    
(command "circle" [b][color=Red]getvar(sd)[/color][/b])
(princ)
)

Posted

This is better:

 

(defun c:isoc (/ ic)

 (initget 6)
 (if (setq ic (getdist "\nEnter Length: "))
   (command "_.circle" pause (* ic 0.816496581)))

 (princ))

Posted

(defun c:isoc (/ ic sd)
(setq ic (getint "\nEnter Length "))
(setq sd (* ic 0.816496581))
    
(command "circle" (getpoint "\nCenter: ") sd)
(princ)
)

 

 

That works great. I really know how to over complicate things i guess:?

 

Only thing is I cant enter a decimal into the length. It asks for a integer. I forgot how to fix that.

Posted
(defun c:isoc (/ ic sd)
(setq ic (getint "\nEnter Length "))
(setq sd (* ic 0.816496581))
    
(command "circle" (getpoint "\nCenter: ") sd)
(princ)
)

That works great. I really know how to over complicate things i guess:?

 

Only thing is I cant enter a decimal into the length. It asks for a integer. I forgot how to fix that.

 

Use Lee Mac's code. It is far more elegant and will allow for non-integers. Or change "getint" to "getdist" in what I gave you.

Posted

The solution provided by architecture68-raff is only half way there (no offence intended to architecture68-raff), as it doesn't allow for a null user input, and uses getint as opposed to getreal or getdist.

 

Mike - you really need to be looking at AfraLISP or Jeffery Sanders to learn how to use these functions.

 

Also, I presume by the error with the quote marks, that you are using notepad to write your LISPs? You will encounter a lot more mistakes without using a syntax highlighting program.

Posted
The solution provided by architecture68-raff is only half way there (no offence intended to architecture68-raff), as it doesn't allow for a null user input, and uses getint as opposed to getreal or getdist.

 

No offense taken :)

 

I was merely trying to point him in the right direction, not do it for him.

Posted

Thats all. Lee It works great. I dont use lisp all that often. there is so much logic of it I just dont understand.

Posted

Also, I presume by the error with the quote marks, that you are using notepad to write your LISPs? You will encounter a lot more mistakes without using a syntax highlighting program.

 

Yeah, I am. What would you suggest using? I know CAD has a autolisp editor. But I don't know how to use it. Is there a tutorial somewhere?

Posted

Mike,

 

Type VLIDE or VLISP at the command line to open ACAD's Visual LISP Editor.

 

Then go to File > New File and you can start typing your LISP out.

 

More info on debugging etc can be found here:

 

http://midpointcad.com/au/docs/lakose_The_Visual_LISP_Developers_Bible.pdf

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