Page 1 of 1

Length and image rotate

Posted: 23 Apr 2010, 14:13
by Zdravko
Hi
You have wroted this example:

var
x, x1, y, y1, length: double;

begin
x := (CADViewX1.CADImage.Converter.Sections[2].Entities[0] as ICADLine).Point.X;
x1 := (CADViewX1.CADImage.Converter.Sections[2].Entities[0] as ICADLine).Point1.X;
y := (CADViewX1.CADImage.Converter.Sections[2].Entities[0] as ICADLine).Point.Y;
y1 := (CADViewX1.CADImage.Converter.Sections[2].Entities[0] as ICADLine).Point1.Y; ...


Looks like you are missing (in this example) how to get length of line?

Also, I have done some things, and now I have problem when loading DWG which is rotated. When I draw line or text from code, like this example:

CADViewX1.Actions.Item("New").Execute()
set Img = CADViewX1.CADImage
set Conv = Img.Converter
set Entities = Conv.Sections(2)
set Txt = CreateObject("CADViewLib.Text")
Txt.Height = 10
Txt.Text = "Simple line text"
set Point = CreateObject("CADViewLib.Point3D")
Point.X = variable1
Point.Y = variable2
Point.Z = variable3
Txt.Point = Point
Txt.Color = RGB(255, 0, 255)
Entities.AddEntity(Txt)
Conv.Loads(Txt)
Img.RecalcExtents
Img.RefreshCurrentLayout
CADViewX1.Actions.Item("Fit to Window").Execute()

I become drawn object somewhere else, but not there where are variable1,2 and 3 values.
Variable1,2 and 3 I become with CADCoords, on MouseMove event.

Have try with RotDefault and RotToView, and image rotate OK, but line is drawn on some else place as I have become with CADCoords

Thx
ZDravko

Re: Length and image rotate

Posted: 26 Apr 2010, 02:49
by Zdravko
Anyone please?

Re: Length and image rotate

Posted: 27 Apr 2010, 12:50
by support
Hello Zdravko.
Rotated drawing shown generally in 3D view but the display 2D point in CADViewX is a projection of point from XY plane of drawing to the screen. Please check directions of the axes in your DWG. Entity added by mouse will appear at corresponding point on drawing XY plane.

Alexander.

Re: Length and image rotate

Posted: 27 Apr 2010, 17:12
by Zdravko
> Please check directions of the axes in your DWG
How to do that, please ?

> Entity added by mouse will appear at corresponding point on drawing XY plane
I'm adding entity by code, not by mouse.
Have send you VBS example and DWG file

Re: Length and image rotate

Posted: 27 Apr 2010, 18:00
by support
Hello Zdravko.
The directions of axes on drawing can be learned if select any line entity and look at its points' coordinates. However UCS defined in the DWG you sent. Coordinates in WCS required to add entity.

Alexander.