Jump to content

Recommended Posts

Posted

I'm trying to get this Lisp file to insert my col bub and it doesn't seem to work.

Can someone help me a little.

COLTAG1.LSP

Posted

See inline, just a few quick hints, others might be able to help you out in a better way.

 


;Program COLTAG1.LSP (Draws Column tag at end of grid line)
;
(Prompt 
"\nInitial Load...Please wait.\n")
;
(Defun C:COLTAG1 (/ z:E1 z:IP z:Ang 
z:TVar)
      (SetVar "CMDECHO" 0)
 ; 
you could use (Setq CmdEchoOld (getvar "CMDECHO"))
 ; This goes for all 
the systemvariables you want to change temporary.


      (Command "OSNAP" "NONE")
 ; 
again, store the old vars, like (setq OsmodeOld (getvar 
"OSMODE")).....

      (setq LR1 
(tblsearch "layer" "SGRBU"))

(if (= LR1 
nil)

(command "-layer" "new" "SGRBU" "color" "7" "SGRBU" "set" "SGRBU" 
"")

(command "-layer" "set" "SGRBU" "")

)
      (Setq z:E1 
nil)
      (While (null 
z:E1)

(Setq z:E1 (EntSel "\nPick endpoint of line to label: 
")))
      (Setq z:IP (osnap (cadr z:E1) 
"ENDP")

z:E1 (EntGet (car z:E1)))

(Cond
         ((< (Distance 
z:IP (cdr (assoc 10 
z:E1)))

(Distance z:IP (cdr (assoc 11 
z:E1))))

(Setq z:IP (cdr (assoc 10 
z:E1))

z:Ang (Angle (cdr (assoc 11 z:E1)) 
z:IP)))

(T

(Setq z:IP (cdr (assoc 11 
z:E1))

z:Ang (Angle (cdr (assoc 10 z:E1)) 
z:IP))))
      (Setq z:IP (Polar z:IP z:Ang (/ 
(GetVar "DIMSCALE") 4.0)))
      (Command 
"INSERT" "100000" z:IP (/ (GetVar "DIMSCALE") 2.0) "" 
0)
      ; (Command z:Tvar[color=darkred]);  what is [/color]
[color=darkred]this??? THere is no function z:Tvar in this [/color]
[color=darkred]code.[/color]
      (SetVar "CMDECHO" 
1)
      (Princ)
)

 

A side note: I am not able to "justify" the code more readable on this forum, too bad. Look like a big mess this way. Also I can't change the color like I want. Maybe CADtutor is in a dip like me :-)

Posted

Hi and thanks a bunch. I'm stupid with lisp but I'm trying. A push in the right direction helps a bunch.

My lisp files all came off of my 2004 setup. it was my duct drawing setup. Something went wrong with the complete setup as far as lisp files and what else I'm unsure of. It got to the point of not even loading up autocad. When it started acting up I found that all or most of the lisp files had become corrupted even the directory of originals. I did a post here and on autodesk, and tried to fix it from the answers from autodesk but to no avail. So I'm in the process of trying to setup on one of my newer systems for duct drawing. At the same time I'm trying to fix all the little quirks and errors that was never right in the first place.

 

" side note: I am not able to "justify" the code more readable on this forum, too bad"

I don't understand clearly what your saying here.

 

I will look into what you have pointed out. I've been on Afralisp for the last few weeks and I'm finding it helpful but I'm in a time crunch and could use all the help anyong can muster.

 

Well I got to mow grass for now and will get to things later.

 

Thanks again.

Posted

Back at it and worked all day off & on. I completely rewote the file and now it works. But I have questions. When I start the command, it prompts me to pick the end point of a line, when I get close to the end point, I expect the magnet box to show telling me that my crosshairs have acquired the end point. Well it doesn't. Can you tell me why it does this? I want the acquisition box to show and the prompt beside the crosshair to highlight and show the word endpoint. I also want to put in a "While" statement to keep the command active until I'm done tagging. Can you tell me where to put the statement?

COLTAG-A.LSP

Posted

This is because you're using entsel. That opens the selection cursor which doesn't use object snaps.

 

To get around this what you could do is use a getpoint instead. Thereafter you can either use nentselp and pass the point to it, or use ssget with an :E modifier and the point.

 

The "nice" thing about the ssget, is you can also filter for any selection set filters (e.g. only pick lines).

Posted

I got another question, before, when using the old version file (i haven't tried it on the new file yet), when the command was invoked, I was unable to pick polylines, not saying that I would create a grid with polylines, but sometimes drawings from other vendors have polylines in the grid. how would I get aroung this and be able to pick plines as well?

Posted

The current one should be able to pick any entity type since it uses entsel. My best guess is that the previous one used some form of ssget instead - that's the only way I know of to disallow selecting particular entities. Unless the previous one checked the entity type after the entsel, and then looped until that was acceptable.

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