Jump to content

Macro Help


Jrbuds

Recommended Posts

Hi, I am trying to create a macro (or lisp) and am struggling to find how I would do it.

 

Basically what I want to achieve is this:

 

Click Custom button,

Click first point (p1)

Click second point (p2)

Insert block at p1 and set scale to equal distance between p1 and p2

Set bearing to the bearing between p1 and p2

then end.

 

The process will take 3 clicks including click the custom button.

 

This is to basically speed up inserting doors.

 

I was thinking possible making it draw a line when you click p1 and p2 then use this line to grab the start of line, end of line and bearing.

 

Or using variables.

 

Any help would be appreciated, or pointing in the right direction. I don't expect anyone to do all the work for me, just a hint would be awesome. :)

Link to comment
Share on other sites

Welcome to CadTutor . :)

 

Things like this ... ?

 

(defun c:Test (/ bk 1p 2p)
 (setq bk "[color=red]BlockName[/color]") ;; Specify the name of block here .
 (cond
   ((not (tblsearch "BLOCK" bk))
    (alert "\n The Block Name is not found !!")
   )
   ((and (setq 1p (getpoint "\n Specify First point :"))
         (setq 2p (getpoint "\n Next point :" 1p))
    )
    (command
      "_.-insert"
      bk
      "_none"
      1p
      (distance 1p 2p)
      (distance 1p 2p)
      (polar 1p
             (angle 1p
                    (mapcar (function (lambda (q p) (* (+ p q) 0.5)))
                            1p
                            2p
                    )
             )
             1.0
      )
    )
   )
 )
 (princ)
)

Link to comment
Share on other sites

Tharwat brilliant as usual, Jrbuds only issue with a door if your showing a arc is which way is the swing you may need a extra pick saves having a left and right of every door.

Link to comment
Share on other sites

Tharwat brilliant as usual, Jrbuds only issue with a door if your showing a arc is which way is the swing you may need a extra pick saves having a left and right of every door.

 

Thank you Bigal for the nice words . :)

 

Let's wait and see what Jrbuds wants to do with the code .

Link to comment
Share on other sites

Jrbuds do you want walls doors window roofs etc dynamic input into 2.5D plans its commercially available very cheap prior to Acad Architectural works in standard autocad.

 

3dhouse.jpg

CADARC.JPG

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