TheSwamp

Code Red => VB(A) => Topic started by: rkmcswain on February 21, 2006, 08:05:39 AM

Title: Create named view with twist
Post by: rkmcswain on February 21, 2006, 08:05:39 AM
I'm probably missing something simple here, but how do you define a
named view that is not parallel to the WCS?

See attached image. I need to define a view for each rectangle. In lisp,
group 50 defines the twist angle, but from everything I have seen, this
property doesn't exist for the View object in VBA.

TIA

(http://usera.imagecave.com/thecadmaster/cad/nv.png)

(Duplicate of post made in [news://discussion.autodesk.com/autodesk.autocad.customization.vba] on 20 Feb)
Title: Re: Create named view with twist
Post by: MP on February 21, 2006, 09:19:11 AM
As far as I know you have to use entmake / entmod unless you resort to arx.
Title: Re: Create named view with twist
Post by: MP on February 21, 2006, 09:41:35 AM
PS: Welcome to the swamp Mr. McSwain.

:)
Title: Re: Create named view with twist
Post by: Draftek on February 21, 2006, 09:57:20 AM
hmm. I just happen to be finishing up a context menu for rotating viewports in c#.

It sure does look like autodesk is slowly dropping support for the activex interface.
Title: Re: Create named view with twist
Post by: Kerry on February 21, 2006, 10:05:41 AM
Welcome to theSwamp RK'

That piccy looks familiar, but my brain is shot and it's past pumpkin time.

I have a recollection that Glenn < GlennR> has done some work on this issue .. he may drop in ..
Title: Re: Create named view with twist
Post by: MickD on February 21, 2006, 04:44:06 PM
while this isn't a coded solution you can use it to create your saved views.
Set the ucs (objectUCS) to the rectangular object you want the view on, go to the views menu, select 3dviews->planview->current ucs. This will set up your view at the twisted angle. Or at the command prompt -> 'plan' 'enter'
To save the view open the  named views dialog and selct 'New', here you can also define a size for the view with a selected window.

As both the view and viewport objects derive from the AcDbAbstractViewTableRecord object, both of these objects have this functionality available in ARX but I couldn't see it in the vba object model. There may be a way of working with a viewport object and checking tilemodes etc to define whether the view in question is a view or viewport object but that may be a longshot(?)

hth.
Title: Re: Create named view with twist
Post by: rkmcswain on February 21, 2006, 04:59:14 PM
Although I have abandoned the whole idea...  :cry:

...here is how I almost got it to work. It may be helpful to someone trying to create one view.


(steps 1-3 is necessary so that the center point you pass to the entmake call is a DCS coordinate)

Everything worked except that this was running in a loop, and each lisp code simply stayed in memory until the VBA code finished, then it executed. Well, since I was writing the same file over and over, only the last lisp ran.

I could have probably made it work by writing unique files, but by this point I felt I was walking in glass as it was. Too convoluted and kludgy to be a real solution. I suppose if you needed to create a single view every now and then, this method might work. But this app may have to create hundreds of views at one time.

I understand it may be possible to create named views using .NET? Any thoughts?
Title: Re: Create named view with twist
Post by: LE on February 21, 2006, 05:06:58 PM
Since is something I have not used in normal autocad, I am not familiar with the steps... but it is possible that I can write a command using objectARX....

Let me read the whole thread....
Title: Re: Create named view with twist
Post by: MickD on February 21, 2006, 05:08:47 PM

I understand it may be possible to create named views using .NET? Any thoughts?

Yes you could as the ViewTableRecord inherits from the AbstractViewTableRecord which has a ViewTwist property with get/set methods. The hard bit will be working out your twist angle from the objects.
Title: Re: Create named view with twist
Post by: Glenn R on February 21, 2006, 09:25:11 PM
I created just such a beastie as you describe 6 months ago and it will do hundreds of views in seconds.

These are then cloned into other drawings that are created in memory (again literally several hundred drawings created per minute) with the relevant view set.

I am busy at the moment, but will chime in with more tonight. BTW, there is no elegant way to do this in ActiveX VBA...you have to use lisp, .NET or ARX.

Cheers,
Glenn.