Jump to content

Recommended Posts

Posted

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!

Posted

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.

Posted

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?

  • 3 months later...
Posted
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.

Posted

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 :)

Posted

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.

Posted

I leave it open to modification - I just wrote it real quick :)

Posted

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.

Posted

Is it mandatory that you don't use LISP?

 

Why not use a macro like:

 

^C^Ccondu

 

Using the code from above?

Posted

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

Posted
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!

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

Posted
I know, but I wanted to make sure you were aware of the limitation with setvar "clayer".

 

Thanks :)

  • 4 months later...
Posted (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 by oldsoftboss

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