CADgirl Posted January 20, 2010 Posted January 20, 2010 I have no idea how to write a macro. I need one that would draw a conduit line. Basically I need a polyline that would fillet the corners to a radius if 4" and it would be on the e-powr-circ layer. It's really simple I know, but could someone please explain it to me? Thanks! Quote
Lee Mac Posted January 20, 2010 Posted January 20, 2010 A macro is basically an automation of user input, where such symbols as ";" and a space are equivalent to the user pressing enter, and a "\" is equivalent to pausing for user input. LISP/Visual LISP has more power and can be called from a macro, you may be better off this way. Quote
ReMark Posted January 20, 2010 Posted January 20, 2010 So you want to draw a conduit line (represented by a single or double line?) using a polyline (any width applied?) and everytime the conduit turns a corner you want to apply a 4" radius to it. The new conduit line (are you using a standard AutoCAD linetype or a custom line type?) will be "forced" to layer e-powr-circ. Sound correct? Quote
CADgirl Posted May 17, 2010 Author Posted May 17, 2010 So you want to draw a conduit line (represented by a single or double line?) using a polyline (any width applied?) and everytime the conduit turns a corner you want to apply a 4" radius to it. The new conduit line (are you using a standard AutoCAD linetype or a custom line type?) will be "forced" to layer e-powr-circ. Sound correct? Yes. That's exactly what I want. A single line and no width applied to the polyline. Quote
Lee Mac Posted May 17, 2010 Posted May 17, 2010 How about something quick like this: (defun c:condu ( / *error* LastEntity OldLayer pt ent ) (defun *error* ( msg ) (and OldLayer (setvar "CLAYER" OldLayer)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq LastEntity (entlast) OldLayer (getvar "CLAYER")) (or (tblsearch "LAYER" "e-powr-circ") (command "_.-layer" "_M" "e-powr-circ" "")) (if (and (setq pt (getpoint "\nSpecify start point: ")) (progn (setvar "CLAYER" "e-powr-circ") (command "_.pline" pt "_W" 0.0 0.0) (while (= 1 (logand 1 (getvar 'CMDACTIVE))) (command pause)) (not (equal LastEntity (setq ent (entlast)))) ) ) (progn (setvar "FILLETRAD" 4.0) (command "_.fillet" "_P" ent) ) ) (setvar "CLAYER" OldLayer) (princ) ) Just uses command calls - should hopefully get you by Quote
alanjt Posted May 17, 2010 Posted May 17, 2010 FYI Lee, (setvar "CLAYER will fail if the layer is frozen. When using command, you are better off to just thaw & set with layer command. Quote
Lee Mac Posted May 17, 2010 Posted May 17, 2010 I leave it open to modification - I just wrote it real quick Quote
CADgirl Posted May 17, 2010 Author Posted May 17, 2010 I was wanting to just write a macro- I'm doing this from the cui. This is what I have so far: ^C^C-la s e e-powr-circ; pline \\\\ fillet;u;r;4 But I don't know how to set it so that I can have unlimited points with my polyline- currently I have 4. And to fillet, I have to select the corners manually. I have to figure out to have it fillet all corners automatically. Quote
Lee Mac Posted May 17, 2010 Posted May 17, 2010 Is it mandatory that you don't use LISP? Why not use a macro like: ^C^Ccondu Using the code from above? Quote
CADgirl Posted May 17, 2010 Author Posted May 17, 2010 Can you use a lisp in the cui? I thought I had to use a macro there. Somehow the macro (or whatever was in the cui) for this command got deleted. There is already a pull deown menu and everything for it, so I just wanted to re-create what was there before. I hope that made sense. . . sorry, it's monday. Quote
CADgirl Posted May 17, 2010 Author Posted May 17, 2010 Is it mandatory that you don't use LISP? Why not use a macro like: ^C^Ccondu Using the code from above? Just tried it and it worked! Exactly what I wanted. Thank you! Quote
alanjt Posted May 18, 2010 Posted May 18, 2010 I leave it open to modification - I just wrote it real quick I know, but I wanted to make sure you were aware of the limitation with setvar "clayer". Quote
Lee Mac Posted May 18, 2010 Posted May 18, 2010 I know, but I wanted to make sure you were aware of the limitation with setvar "clayer". Thanks Quote
oldsoftboss Posted September 29, 2010 Posted September 29, 2010 (edited) Hi All, This is something I have been looking for, and have been able to adapt it for my purpose. Fantastic One question, (of course) How would the code go if you wanted the fillet radius to be able nomiated at the start of the command (maybe with a default value) and then used to fillet the polyline? Edited September 29, 2010 by oldsoftboss Quote
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.