Jump to content

What is meaning of: "bad argument type: lentityp"


rayg11757

Recommended Posts

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.

Link to comment
Share on other sites

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • drwhite

    10

  • The Buzzard

    5

  • rayg11757

    4

  • CHLUCFENG

    3

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Two things:

  1. STRCASE:
    Command: (strcase nil)
    Error: bad argument type: stringp nil


  2. 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").

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