Author Topic: Simple freebie help needed :-)  (Read 2349 times)

0 Members and 1 Guest are viewing this topic.

R_rogerD

  • Guest
Simple freebie help needed :-)
« on: May 13, 2015, 07:39:30 AM »
Hi all,

I am totally new to writing programming for AutoCAD and in writing Lisps and Macros etc. I am attempting to write some of my own scripts from tutorials off of the Internet but it is a very slow process. I thought that I'd try for a little 'Freebie' help instead on here :-) No harm in asking eh? Hopefully, they are both really simple tasks with simple solutions.

Query 1:
I wish to click on a block and have it automatically rotate about it's insert point. The user then clicks on the second rotation point only.
IE 2x clicks of the mouse only. No acceptance click and no base point click. Currently, using standard ACad commands, requires 4x clicks with obs snaps on.

Query 2:
I wish to rotate and then move as a single operation. IE (normal Rotate command) - drag & select the object/s; right click to accept; point and click on base point; click on second rotation point but then..... (normal Move command but with objects remain selected); point and click for base point and then click for second displacement point. No specifics with regards object snapping.

If this request is considered too cheeky, I apologise. Hopefully, for someone who knows what they are doing, it will be a simple five minute task. :-)

Big thanks in advance.

Rroger_D

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Simple freebie help needed :-)
« Reply #1 on: May 13, 2015, 08:53:21 AM »
For Query 1:
Code: [Select]
(defun c:br ( / ent enx )
    (while
        (progn (setvar 'errno 0) (setq ent (car (entsel "\nSelect block: ")))
            (cond
                (   (= 7 (getvar 'errno))
                    (princ "\nMissed, try again.")
                )
                (   (null ent) nil)
                (   (/= "INSERT" (cdr (assoc 0 (setq enx (entget ent)))))
                    (princ "\nSelected object is not a block.")
                )
                (   t
                    (vl-cmdf "_.rotate" ent "" "_non" (trans (cdr (assoc 10 enx)) ent 1))
                    (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\\"))
                    nil ;; exit loop
                )
            )
        )
    )
    (princ)
)

For Query 2: MOCORO :-)
« Last Edit: May 13, 2015, 08:58:23 AM by Lee Mac »

tedg

  • Swamp Rat
  • Posts: 811
Re: Simple freebie help needed :-)
« Reply #2 on: May 13, 2015, 03:50:57 PM »
Lee....
You're awesome.


[beer]
Windows 10 Pro 64bit, AutoCAD 2023, REVIT 2023

ribarm

  • Gator
  • Posts: 3263
  • Marko Ribar, architect
Re: Simple freebie help needed :-)
« Reply #3 on: May 13, 2015, 04:11:41 PM »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

R_rogerD

  • Guest
Re: Simple freebie help needed :-)
« Reply #4 on: May 13, 2015, 05:41:27 PM »
Hi,

Absolutely fabulous!!

I knew someone could do it easily enough. Great big thank yous..... :-)

I wasn't aware of the MOROCO command. I am now. Hopefully I can learn something from the way it has been written also.

Thanks for your comment ribarm. I did try the coding as per the link, although it seemed quite complicated. As with everything, I guess it is simple once you know how it works.

Thanks all.

Rroger_D

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Simple freebie help needed :-)
« Reply #5 on: May 15, 2015, 04:43:54 AM »
Lee....
You're awesome.

[beer]

Cheers Ted!  :-)

Absolutely fabulous!!

I knew someone could do it easily enough. Great big thank yous..... :-)

I wasn't aware of the MOROCO command. I am now. Hopefully I can learn something from the way it has been written also.

You're most welcome R_rogerD, happy to help  :-)