SetPlotWindowArea() got an offset

SetPlotWindowArea() got an offset

Anonymous
Not applicable
3,151 Views
5 Replies
Message 1 of 6

SetPlotWindowArea() got an offset

Anonymous
Not applicable

Hello, Everyone! I am trying to batch plot blocks by using c#.

 

The problem is in some dwg files the plot window area got an offset, but in some files the program runs quite well. The offset looks like this:

 

offset.jpg

 

 

Here is part of the code:

 

 

// get extents of the block
Point2d ptMin = block.GeometricExtents.MinPoint.Convert2d(new Plane()); Point2d ptMax = block.GeometricExtents.MaxPoint.Convert2d(new Plane()); Extents2d window = new Extents2d(ptMin, ptMax); // set plot window psv.SetPlotWindowArea(ps, window); psv.SetPlotType(ps, Autodesk.AutoCAD.DatabaseServices.PlotType.Window); psv.SetPlotCentered(ps, true); psv.SetStdScaleType(ps, StdScaleType.ScaleToFit);

In debugging, I can see the value of ptMin and ptMax is right, and the value in PlotInfo is also right, so I am really confused about it. By the way, I have change the UCS to WCS too.

 

Thanks for reply!

 

0 Likes
Accepted solutions (1)
3,152 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Check the TARGET variable, the ones that have the offset probably have a TARGET that is not 0,0,0.

Message 3 of 6

Anonymous
Not applicable

Yes, it is the TARGET variable that causes the offset.

 

I found this post online: Plot or preview shows incorrect area of drawing when plotting limits

 

But how to change it by code?

Thank you for reply so soon!

0 Likes
Message 4 of 6

Alexander.Rivilis
Mentor
Mentor
Accepted solution

You have translate coordinates from WCS to DCS: Plot To Window Extents Using VBA

With help of Autodesk.AutoCAD.Internal.Utils.UcsToDisplay(Point3d ucsPoint, bool bPaperSpace) you can translate UCS to DCS

In order to translate WCS to UCS you can use invert matrix Editor.CurrentUserCoordinateSystem

 

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 5 of 6

Anonymous
Not applicable
Thank you so much! Now it works very well by your advice.
0 Likes
Message 6 of 6

Anonymous
Not applicable

thank you my friend .

im try 3 days for this

0 Likes