Author Topic: Plot orientation  (Read 2890 times)

0 Members and 1 Guest are viewing this topic.

ANDYSMI

  • Guest
Plot orientation
« on: January 16, 2013, 05:03:54 PM »
I can not seem to reliably extract the plot orientation (landscape / Portrait) from a layout's plot configuration. I'm writing in VB.net but I've learned to convert from C++ or bash well enough so examples could be in those languages as well. Here is what I'm trying
Code: [Select]
Dim pr As PlotRotation = la.PlotRotation
      Select Case pr
           Case PlotRotation.Degrees000
                Me.TextBox5.Text = "Landscape"
           Case PlotRotation.Degrees090
                Me.TextBox5.Text = "Portrait"
      End Select
la is a layout object. I've also tried using the plot settings from the layout as they have a plot rotation property as well. The code runs fine but the orientation reported is not what is show in the plot dialog box.
Why I'm asking questions, if I convert the layout's PlotOrigin to a string, I get some weird amount that appears to be maybe millimeters as an inch is a little over 25. Is there some convertion?

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Plot orientation
« Reply #1 on: January 17, 2013, 12:34:12 AM »

Defined as
Code - Visual Basic: [Select]
  1.  
  2. Public Enum PlotRotation
  3.     ' Fields
  4.    Degrees000 = 0
  5.     Degrees090 = 1
  6.     Degrees180 = 2
  7.     Degrees270 = 3
  8. End Enum
  9.  
And looks like should be



    Degrees000 = Portrait
    Degrees090 = Landscape
    Degrees180 = Portrait - Upside doown checked
    Degrees270 = Landscape - Upside doown checked


ANDYSMI

  • Guest
Re: Plot orientation
« Reply #2 on: January 17, 2013, 09:37:12 AM »
Jeff:
Thanks for replying. Do I need to put the public enums that you posted in my code?
I'm still getting wacky results from the property method. Even if I just look at the returned value it is not consistent with what I'm seeing in the drawing. I'm going to try on some other drawings. Maybe the drawing I'm testting with is screwy.
Anyhow, any clue on how to decipher the value returned by plotorigin?

n.yuan

  • Bull Frog
  • Posts: 348
Re: Plot orientation
« Reply #3 on: January 17, 2013, 09:42:27 AM »

Defined as
Code - Visual Basic: [Select]
  1.  
  2. Public Enum PlotRotation
  3.     ' Fields
  4.    Degrees000 = 0
  5.     Degrees090 = 1
  6.     Degrees180 = 2
  7.     Degrees270 = 3
  8. End Enum
  9.  
And looks like should be



    Degrees000 = Portrait
    Degrees090 = Landscape
    Degrees180 = Portrait - Upside doown checked
    Degrees270 = Landscape - Upside doown checked

Shouldn't "Portrait/Landscape" be decide by both Rotation and paper's Heigh/Width?

That is, for a paper with its height greater than its width, Degree000 mean Portrait, while for a paper with its heigh is less than its width, Degree000 means Landscape. So, if you want to make sure the plot is portrait or landscale, you need to know the defined paper size, than rotate it accordingly.

ANDYSMI

  • Guest
Re: Plot orientation
« Reply #4 on: January 17, 2013, 09:51:50 AM »
humm...
good point I guess. Will try to see if that helps. The drawing I was testing with seems like it might be the problem with getting inconsistent results.
Also I've figured out that PlotOrigin is being returned in millimeters. If I divide by 25.4, I get the correct amount. This is even with units set to inches. Wondering if it always is going to be returned in millimeters.
Programming against Acad's plot function is challenging

ANDYSMI

  • Guest
Re: Plot orientation
« Reply #5 on: January 17, 2013, 10:17:55 AM »
n.yuan:
I believe you have pointed me in the right direction. The layouts the are reporting wierd results are in fact 'letter' sized sheets that are in landscape which for letter is turned 90 (on it's side). So I'm going to have to check page size to decipher orientation.
Now new question What is an eLockViolation and what causes it.
It seems like the program throws the violation after I open the plot dialog box inside autoCAD and then try to check another layout's properties in my program.

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: Plot orientation
« Reply #6 on: January 17, 2013, 11:54:19 AM »
n.yuan:
I believe you have pointed me in the right direction. The layouts the are reporting wierd results are in fact 'letter' sized sheets that are in landscape which for letter is turned 90 (on it's side). So I'm going to have to check page size to decipher orientation.
Now new question What is an eLockViolation and what causes it.
It seems like the program throws the violation after I open the plot dialog box inside autoCAD and then try to check another layout's properties in my program.

As in you've got the plot dialog open while your program is running?

If that's the case it's probably caused by the plot dialog placing a DocumentLock on the Document.  I have also run into some situations where the Document needs to be locked to perform some operations and while it is implied in a basic command it needs to be explicitly included when CommandFlags.Session is invoked.

Hope that helps.