TheSwamp

Code Red => .NET => Topic started by: latour_g on September 02, 2022, 03:35:13 PM

Title: Viewport creation with SCU not world
Post by: latour_g on September 02, 2022, 03:35:13 PM
I have a command that create a viewport by selecting the zone in object.  It's working fine except when UCS is not general and plan is set to current (see image).

The code is quite long so I'll put here just the part where I create the viewport.

What would be the parameter of the viewport to determine the center and the right angle (I thought it was CenterPoint and twistangle but it doesn't seem to work) ?

I'll put more info if it's not clear enought.  Thank you !

Code: [Select]
           
Viewport vp = new Viewport();                   
vp.SetDatabaseDefaults();                   
//vp.CenterPoint = new Point3d(positionMV.X + 200, positionMV.Y + 200, positionMV.Z);                   
vp.CenterPoint = positionMV;                   
vp.Width = distanceX;                   
vp.Height = distanceY;                   
vp.ViewCenter = ptMVsup;                   
vp.Locked = true;                   
//vp.TwistAngle = 15;
Title: Re: Viewport creation with SCU not world
Post by: It's Alive! on September 02, 2022, 08:42:16 PM
ViewDirection? just guessing  :mrgreen:
Title: Re: Viewport creation with SCU not world
Post by: latour_g on September 06, 2022, 03:51:04 PM
It could be that, I just don't see how I should create the vector for ViewDirection.

I also tried this but without success :

Code - C#: [Select]
  1. Matrix3d mat3D = ed.CurrentUserCoordinateSystem;
  2. vp.TransformBy(mat3D);

and

Code - C#: [Select]
  1. vp.SetUcs(ed.CurrentUserCoordinateSystem);


Title: Re: Viewport creation with SCU not world
Post by: It's Alive! on September 07, 2022, 02:27:35 AM
I think you can get the view direction from VIEWDIR system variable
Title: Re: Viewport creation with SCU not world
Post by: gile on September 07, 2022, 07:19:56 AM
Hi,
IMHO, the first thing to do is to transform the coordinates aquired with a prompt result from UCS to WCS.