Author Topic: Viewport creation with SCU not world  (Read 2144 times)

0 Members and 1 Guest are viewing this topic.

latour_g

  • Newt
  • Posts: 184
Viewport creation with SCU not world
« 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;

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8661
  • AKA Daniel
Re: Viewport creation with SCU not world
« Reply #1 on: September 02, 2022, 08:42:16 PM »
ViewDirection? just guessing  :mrgreen:

latour_g

  • Newt
  • Posts: 184
Re: Viewport creation with SCU not world
« Reply #2 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);



It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8661
  • AKA Daniel
Re: Viewport creation with SCU not world
« Reply #3 on: September 07, 2022, 02:27:35 AM »
I think you can get the view direction from VIEWDIR system variable

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Viewport creation with SCU not world
« Reply #4 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.
Speaking English as a French Frog