.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to hookup to UcsChanged event?

4 REPLIES 4
Reply
Message 1 of 5
nyme
585 Views, 4 Replies

How to hookup to UcsChanged event?

I am using AutoCAD overrules to display text over some objects.  This text is used as a "label" to display information about this item.

 

One of the rmequirements of this is that the text is ALWAISE displayed strait for the user (horizontaly), no matter what the rotation of the object in question is and NO MATTER THE ROTATION OF THE CURRENT VIEW AND UCS.  This is fairly simple, and works great, except for one thing: 

Right now, every time the overrule method is called, I have to re-calculate the current UCS rotation according to the WorldUCS (rotation of the text object = Current UCS Rotation - Current View Rotation [based on current UCS]).  The Curent view rotation is calculated / stored every time the current view changes (ViewChanged event), so I don't have to recalculate it.

 

So I am looking for a way to register the UcsChanged event so I can simply recalculate the rotation value when it changes instead of doing it for all of the objects in the drawing.  I have found the event itself in the object browser (Autodesk.AutoCAD.Internal.Reactors.UcsEventManager.UcsChanged), but I can't seam to find an instance of the UcsEventMaager to hookup to.

 

The reason I described this in details is that there may be a simpler solution.  Any ideas?

 

Has anybody ever done this?  Do I need another References?

Also, please indicate (if possible of course) where in the documentation (ObjectARX or Developer's documentation or whatever) I coud find this information!

 

Thanks alot for any support!

4 REPLIES 4
Message 2 of 5
caddzone
in reply to: nyme

Assuming you're talking about a Drawable

overrule, and overriding its WorldDraw(),

you should be using ViewportDraw() for

what you're trying to do.

 

What if there's multiple viewports showing

the same object in different view orientations?

 

 



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


Message 3 of 5
nyme
in reply to: nyme

Haha, thanks for the info...  But will it apply in Model (is ModelSpace also a viewport)?

 

And...  it doesn't help me with my question, right?  Or is there something in the args of the event that allows me have the rotation values?

 

Thanks for the response!!!

Message 4 of 5
caddzone
in reply to: nyme

Yes, it applies to model space views too.

 

I don't have it in front of me, but the arguments passed into ViewportDraw should give

you the needed view transformation for the view. ViewportDraw() is called once for

each viewport.



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


Message 5 of 5
nyme
in reply to: caddzone

Very cool! But can you point me in the direction of an exemple for this code? I have tried to implement it in a similar way than the WorldDraw override, but it does not fire... I will post code tomorow... Thx for the help again!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost