Author Topic: match rotation lisp needed  (Read 6136 times)

0 Members and 1 Guest are viewing this topic.

hudster

  • Gator
  • Posts: 2848
match rotation lisp needed
« on: February 14, 2005, 05:19:28 AM »
Does anyone have a copy of a lisp that will allow me to match the rotation of any entity to that of a selected entity?
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

SMadsen

  • Guest
match rotation lisp needed
« Reply #1 on: February 14, 2005, 05:42:20 AM »
I think you need to define "rotation of any entity". What is the rotation of a line? Of an arc?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
match rotation lisp needed
« Reply #2 on: February 14, 2005, 05:43:36 AM »
this will handle some things, not arcs though.

http://theswamp.org/phpBB2/viewtopic.php?p=42549#42549
TheSwamp.org  (serving the CAD community since 2003)

Big G

  • Bull Frog
  • Posts: 415
match rotation lisp needed
« Reply #3 on: February 14, 2005, 06:29:00 AM »
can you not use the 'align' or 'rotate, reference'?
I thought i seen the light at the end of the tunnel. But it was just someone with a torch bringing me more work.
"You have to accept that somedays youre the pigeon and  somedays youre the statue"

hudster

  • Gator
  • Posts: 2848
match rotation lisp needed
« Reply #4 on: February 14, 2005, 06:44:36 AM »
It's to do a number of things, rotate blocks to align with lines, polylines to match other polylines and rectangles to match lines.

It's something I've been planning to write when I finally figure out what i'm doing with lisp, Stigs course is helping me a lot, but my skills just aren't up to this yet.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

SMadsen

  • Guest
match rotation lisp needed
« Reply #5 on: February 14, 2005, 07:49:30 AM »
Nice to hear the course is at least doing something :D
Thanks, Hudster.

Angle and rotation can be two very different issues when talking entities. Simple objects that are described mathematically usually deal with angle(s) between definition points - an obvious exception being a circle (unless you're talking angle between planes :) ) while objects that possess a unique insertion point deal with rotation.

First step in writing .. or requesting .. a routine that aligns one entity with another would therefore be to define the kind of entity or entities it should handle.

paulmcz

  • Bull Frog
  • Posts: 202
match rotation lisp needed
« Reply #6 on: February 14, 2005, 08:10:01 AM »
(defun c:rtt (/ ss oan nan p1 rot osn)
  (princ "\n Rotate, Select objects: ")
  (setq ss (ssget))
  (setq oan (getangle "\n Angle to be corrected: "))
  (setq nan (getangle "\n New absolute angle: "))
  (setq p1 (getpoint "\n Base point of rotation: "))
  (setq rot (/ (* (- nan oan) 180) pi))
  (setq osn (getvar "osmode"))
  (setvar "osmode" 0)
  (command "rotate" ss "" p1 rot)
  (setvar "osmode" osn)
  (princ)
  )
(prompt "\n type > rtt < to rotate objects")

hudster

  • Gator
  • Posts: 2848
match rotation lisp needed
« Reply #7 on: April 01, 2005, 03:06:43 PM »
What I was looking for, after a bit of thought, is more like the match properties command, but for rotation only.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

daron

  • Guest
match rotation lisp needed
« Reply #8 on: April 01, 2005, 04:52:37 PM »
Hudster, don't you know better where to put your questions??

Here's the pseudo:
user selects object
machine gets rotation angle
user selects other objects
machine replaces other objects RA's with first objects RA

Closer to lisp pseudo:
single entity selection (entsel)
vla or dxf codes to extract
entget, assoc, cdr, ename->vla-object.
ssget: use repeat or convert sset into a list for processing each item with foreach or mapcar
while using one of the previous functions change the items RA to the entsel'd's RA.


Wanna give it a try??