drwhite Posted June 23, 2010 Share Posted June 23, 2010 I found some other problems in your code. These two lines: (command "layer" "s" "hid" "") (COMMAND "LAYER" "S" LAS "") You should make like this: (command "._-layer" "_m" "HID" "") (command "._-layer" "_m" "LAS" "") And these two lines: (command "line" p1v p2v /c/c)) (command "line" p1h p2h /c/c))) Make like this: (command "._line" p1v p2v /c/c)) (command "._line" p1h p2h /c/c))) Is this because the "._" makes the command transparent? How is it more incorrect? I like AutoLisp, and I really like learning on this forum. The info from you and others is very valuable and I always appreciate the tips and corrections. Never make a mistake, never learn anything. Quote Link to comment Share on other sites More sharing options...
drwhite Posted June 23, 2010 Share Posted June 23, 2010 Another thing, my (setvar "osmode" 512) is causing a weird reaction sometimes. For the horizontal line, the line created is either just long just to the left of the termination point I want or just short of it. I don't think I need the osmode to be set to anything but 0. I mean, I am specifying particular set of points for the lines to be created, so why have an osmode setting, right? Quote Link to comment Share on other sites More sharing options...
Small Fish Posted June 23, 2010 Share Posted June 23, 2010 I can't believe that I spent nearly the entire weekend trying to resolve figure this out. At this point it is becoming a mission, although I might be better off bangin my head against the wall. Ray - are you using Autocad's vlide? (visual lisp intergrated development environment ) Type vlide in the command line. This editor has a debuger that will make finding errors a breeze, otherwise if you are using notepad you are going upstream without a paddle. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 23, 2010 Share Posted June 23, 2010 Is this because the "._" makes the command transparent? AutoCAD Command Prefixes: http://www.cadforum.cz/cadforum_en/qaID.asp?tip=2425 Quote Link to comment Share on other sites More sharing options...
drwhite Posted June 23, 2010 Share Posted June 23, 2010 Thanks Lee Mac. I copied that info into a word file I will keep in my lisp routines folders. Anytime I come across good sets of rules, or just general methods I need not overlook, I save them for review. I have lots of books on AutoLisp, but sometimes most of them have the "Yes, you can do that, but the solution is left to the reader" math text type explanation. I prefer the step 1, step 2, step 3 method to "learn" how to do things, then create variations on my own. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted June 23, 2010 Share Posted June 23, 2010 Is this because the "._" makes the command transparent? How is it more incorrect? I like AutoLisp, and I really like learning on this forum. The info from you and others is very valuable and I always appreciate the tips and corrections. Never make a mistake, never learn anything. drwhite, Part of the problem with what you have is you are trying to Set a layer and if the layer is not present in the drawing the program will error. If you use layer Make instead, It will make the layer or if the layer is present, Layer make will still set the layer for you. On you last layer function you were missing quotes around the layer name. Finally as Lee explained to you about the Language compatibility. Quote Link to comment Share on other sites More sharing options...
CHLUCFENG Posted June 23, 2010 Share Posted June 23, 2010 Thanks Lee - I needed that also. Quote Link to comment Share on other sites More sharing options...
drwhite Posted June 23, 2010 Share Posted June 23, 2010 So I figured, well, if they're willing to help me solve the hidden line routine, throw out this one: (defun c:hc();/ ctp rd la stpr stpl os) ;(setq os(getvar "osmode")) (initget "Hid 0 Phan") (setq LA(getkword " Put on layer: Hid/0/Phan<current> ")) (initget "R L") (setq sid(getkword "Which side: R/L<current> ")) ;which side right or left of ctp ;(setvar osmode 32) (COMMAND "._-LAYER" "_S" LA "");put on selected layer (cond ((= R sid) (setq ctp(getpoint "Pick Center" )) (setq rd(getreal "Radius? ")) ;Radius for circle (setq stpr(list(+(car ctp)rd)(cadr ctp))) ;startpoint of radius to right of center (command "._arc" "c" ctp stpr "a" 180) ;draw the arc ) ((= L sid) (setq ctp(getpoint "Pick Center" )) (setq rd(getreal "Radius? ")) ;Radius for circle (setq stpl(list(-(car ctp)rd)(cadr ctp))) ;startpoint of radius to left of center (command "._arc" "c" ctp stpl "a" 180) ;draw the arc ) ) ;(setvar "osmode" os) ;reset osmode back to original setting ) Problem is that it takes the first variable inputs, Layer, side to put the half arc on. But the operation to draw the arc, either left or right of "ctp" (the center point, never happens. I wrote this little ditty to make "jumpers" on simple electrical schematics where you jump over a wire. Problem was it originally was only an arc from 12 to 6 on the 3 oclock side. I wanted to try and make it go (counterclockwise) from 3 to 9, 12 to 6, 9 to 3, or 6 to 12. You know, all four quadrants. This is my first attempt, just right side or left side of a picked point. But now it won't draw either way, it skips the COND section. Help! Quote Link to comment Share on other sites More sharing options...
CHLUCFENG Posted June 23, 2010 Share Posted June 23, 2010 I got it to work this way... (defun c:hc () ;/ ctp rd la stpr stpl os) ;(setq os(getvar "osmode")) (initget "Hid 0 Phan") (setq LA (getkword " Put on layer: Hid/0/Phan<current> ")) (initget "R L") [color=red](setq sid (strcase (getkword "Which side: R/L<current> ")))[/color] [color=red];strcase to cover whether caps lock is on or off - makes variable sid capital[/color] ;which side right or left of ctp ;(setvar osmode 32) (COMMAND "._-LAYER" "_S" LA "") ;put on selected layer (cond [color=red] ((= sid "R");variable is a string[/color] (setq ctp (getpoint "\nPick Center")) (setq rd (getreal "\nRadius? ")) ;Radius for circle (setq stpr (list (+ (car ctp) rd) (cadr ctp))) ;startpoint of radius to right of center (command "._arc" "c" ctp stpr "a" 180) ;draw the arc ) [color=red] ((= sid "L");again, variable is a string[/color] (setq ctp (getpoint "Pick Center")) (setq rd (getreal "Radius? ")) ;Radius for circle (setq stpl (list (- (car ctp) rd) (cadr ctp))) ;startpoint of radius to left of center (command "._arc" "c" ctp stpl "a" 180) ;draw the arc ) ) ;(setvar "osmode" os) ;reset osmode back to original setting ) Chuck Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 23, 2010 Share Posted June 23, 2010 Two things: STRCASE: Command: (strcase nil) Error: bad argument type: stringp nil With getkword, you don't have to worry about case. It will take on whatever you feed to initget (eg. (initget 0 "piZza doG") will return either "piZza or doG"). Quote Link to comment Share on other sites More sharing options...
CHLUCFENG Posted June 23, 2010 Share Posted June 23, 2010 Did not realize - thanks Alan 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.