Author Topic: rotating text in dynamic blocks  (Read 2556 times)

0 Members and 1 Guest are viewing this topic.

dustinthiesse

  • Guest
rotating text in dynamic blocks
« on: February 12, 2009, 05:16:54 PM »
This has been bugging me all day.  I've got a dynamic block that represents a door.  It has two flip actions and an identification tag.

My goal is to get this tag to rotate to display the text horizontally.  So I put a rotation parameter on the tag which I will control via a lisp routine.  My thought was that based on the rotation of the block and the status of the two flip parameters, that I would be able to determine at what angle the rotation parameter needed to be set in order to make it horizontal.

Things seemed to go OK at first, but they got hairy when I started messing around with blocks that had been mirrored (negative scales).

Has anyone experimented with this sort of thing before?  Is it even possible?
Let me know if I need to attach my block and code...I'll be back in the morning.
Thanks in advance!

Serge J. Gianolla

  • Guest
Re: rotating text in dynamic blocks
« Reply #1 on: February 12, 2009, 08:08:14 PM »
This has been bugging me all day.  I've got a dynamic block that represents a door.  It has two flip actions and an identification tag.

My goal is to get this tag to rotate to display the text horizontally.  So I put a rotation parameter on the tag which I will control via a lisp routine.  My thought was that based on the rotation of the block and the status of the two flip parameters, that I would be able to determine at what angle the rotation parameter needed to be set in order to make it horizontal.

Things seemed to go OK at first, but they got hairy when I started messing around with blocks that had been mirrored (negative scales).

Has anyone experimented with this sort of thing before?  Is it even possible?
Let me know if I need to attach my block and code...I'll be back in the morning.
Thanks in advance!
Short of seeing your block, it is like shooting in the dark. Assuming door tag is an attribute and lisp routine is not in the way; give this a shot!

How to keep attributes always at 0 rotation:
Define a point parameter with chained actions & no grips. Associate a move action with that parameter & select the attribute. Define your rotation action as normal, but include the point parameter (NOT the attribute) in its selection set.

dustinthiesse

  • Guest
Re: rotating text in dynamic blocks
« Reply #2 on: February 13, 2009, 10:15:07 AM »
Thanks, I will give it a try when I have the time.
Unfortunately, it looks like that will be next week now  :-(

T.Willey

  • Needs a day job
  • Posts: 5251
Re: rotating text in dynamic blocks
« Reply #3 on: February 13, 2009, 11:08:24 AM »
I'm not sure I'm understand, but I'm gonna post anyway.  :-)

Attributes are separate objects from blocks ( kind of ), so the attribute can have a different rotation from the block, so if you want it to be horizontal, then just put the rotation to 0.0.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

dustinthiesse

  • Guest
Re: rotating text in dynamic blocks
« Reply #4 on: February 13, 2009, 02:56:38 PM »
Mr. Tim, you are a genius...I don't know why that didn't occur to me.

That actually eliminated a lot of the problems I was having (hopefully all of them!).
I was trying to check for negative scales and update the angle on my rotation parameter based on all this crazy stuff, when all I needed to do was set the attribute rotation to 0.

Are there any side effects you can see to this (other than if someone does an "attsync" for some reason, the atts will sort of "reset")?

dustinthiesse

  • Guest
Re: rotating text in dynamic blocks
« Reply #5 on: February 13, 2009, 03:27:35 PM »
Another thing...it seems when the block properties are changed via the properties box (scale/rotation), that an attsync needs to be done in order to 'reposition' them.

But even then, blocks that have either a negative xscale or a negative yscale the attributes are backwards.

So in my code, I am performing an attsync, setting rotation to zero, and then checking for negative scales and setting the backwards property to true.

So far this seems to be working.

Another question, I plan on building this into a reactor of some sort in order to keep the door tags at a rotation of zero, and in the future update door schedules based on the door tag values.
I'm very new at reactors so I am wondering which reactor type would be best suited for this?  Command reactor triggered with a 'regen', when the drawing is saved?  I am trying to think ahead, because if I end up using a command reactor, then I can't use any (command) commands in this code (which eliminates my use of attsync)...

I've attached the code and block.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: rotating text in dynamic blocks
« Reply #6 on: February 13, 2009, 04:52:21 PM »
I think the backward property should be set to false and rotation set to 0.  This seems to work on a test I did.

Why are you using attsync?  I never use it, and I don't see a reason for it, but that may be something you need to use.

I would put an object reactor, so that only that reactor fires when the block gets edited.  Here are some threads to check out.
[ http://www.theswamp.org/index.php?topic=26380.0 ] Alan's code ( CAB )
[ http://www.theswamp.org/index.php?topic=8710.0 ] My learning experience.

Plenty of others if you search here.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.