Page 1 of 1

3D drawing in CADImport

Posted: 10 Dec 2008, 00:25
by lolena1888
Hi,

I have another question to support team.

Is it possible to make 3D drawing in CADImport automatically (just giving 3D points of entities)? If it is Draw3dFace function can you provide me with an example of how I can use it (adding arcs and polylines)?

Is there the way to set angles for 3D coordinates?

Elena

Re: 3D drawing in CADImport

Posted: 11 Dec 2008, 10:09
by support
Hello Elena,
Is it possible to make 3D drawing in CADImport automatically (just giving 3D points of entities)?
Yes, it is. It is necessary to create CADPolyline or CADSpline. They are pure 3D objects. They do not define Z coordinate by extrusion parameter as CADArc does. CADArc is a flat entity. The 3D dimensioning for CAD arcs is defined by extrusion parameter.
If it is Draw3dFace function can you provide me with an example of how I can use it (adding arcs and polylines)?
Please try the following code (it is based on Viewer demo):

Code: Select all

		private void btnAdd3DFace_Click(object sender, System.EventArgs e)
		{
			if(this.cadImage == null) 
			{
				this.cadImage = new CADImage();
				this.cadImage.InitialNewImage();
				this.cadImage.UseDoubleBuffering = false;
			}
			
			this.cadImage.UseDoubleBuffering = false;
			
			CADPolyLine entPolyine = new CADPolyLine();
			CADVertex entVert = new CADVertex();
			entVert.Point = new DPoint(100,100,100);
			entPolyine.AddEntity(entVert);
			entVert = new CADVertex();
			entVert.Point = new DPoint(50,100,10);
			entPolyine.AddEntity(entVert);
			entVert = new CADVertex();
			entVert.Point = new DPoint(100,50,50);
			entPolyine.AddEntity(entVert);
			entVert = new CADVertex();
			entVert.Point = new DPoint(50,50,50);
			entPolyine.AddEntity(entVert);
			entPolyine.Closed = true;
			
			this.cadImage.Converter.OnCreate(entPolyine);
			this.cadImage.Converter.Loads(entPolyine);
			this.cadImage.Converter.Entities.Add(entPolyine);

			CADSpline entSpline = new CADSpline();
			entSpline.Color = Color.Blue;
			DPoint entPoint = new DPoint(100,100,100);
			entSpline.Fit.Add(entPoint);
			entPoint = new DPoint(50,100,10);
			entSpline.Fit.Add(entPoint);
			entPoint = new DPoint(100,50,50);
			entSpline.Fit.Add(entPoint);
			entPoint = new DPoint(50,50,50);
			entSpline.Fit.Add(entPoint);

			this.cadImage.Converter.OnCreate(entSpline);
			this.cadImage.Converter.Loads(entSpline);
			this.cadImage.Converter.Entities.Add(entSpline);

			CAD3dFace ent3DFace = new CAD3dFace();
			ent3DFace.Color = Color.Red;
			ent3DFace.Point = new DPoint(100,100,100);
			ent3DFace.Point1 = new DPoint(50,100,10);
			ent3DFace.Point2 = new DPoint(100,50,50);
			ent3DFace.Point3 = new DPoint(50,50,50);
			ent3DFace.Flags = ent3DFace.Flags | 10;// line 1-2, 3-0 invisible
			
			this.cadImage.Converter.OnCreate(ent3DFace);
			this.cadImage.Converter.Loads(ent3DFace);
			this.cadImage.Converter.Entities.Add(ent3DFace);
  
			CADArc entArc = new CADArc();
			entArc.Color = Color.Green;
			entArc.Point = new DPoint(0, 35.355339059, 125);
			entArc.Radius = 25;
			entArc.StartAngle = 45;
			entArc.EndAngle = 315;
			entArc.Extrusion = new DPoint(1, 1, 0.5);

			this.cadImage.Converter.OnCreate(entArc);
			this.cadImage.Converter.Loads(entArc);
			this.cadImage.Converter.Entities.Add(entArc);

			this.cadPictBox.Invalidate();
		}
Is there the way to set angles for 3D coordinates?
Could you please open the question wider? The angle must be set respectivly to what? And in what plane or planes?

Sergey.

Re: 3D drawing in CADImport

Posted: 11 Dec 2008, 17:33
by lolena1888
Sergey,
thanks to all your helpful feedback. Your examples help me to understand better where I can use draw classes to distinguish better results.

Question about angles. I believe that there exist different standards for drawing and viewing 3D objects. Isometria, dimetria...etc (I am not sure if I spell it correctly in English). I am pretty confident that our client uses AutoCad axises, but just in case if I need to change the view and my object has 3D coordinates can I just set the coordinates to have different angles in 3D representation of X,Y and Z?

Of course, I can do it with some koefficients, but I wonder if there is built-in properties that I can use in my code.

Again,
thanks for your support.

Elena

Re: 3D drawing in CADImport

Posted: 12 Dec 2008, 09:40
by support
Hello Elena,

Do you mean that you need to perform 3D rotating of separate entities independently of the others within a drawing?

Sergey.

Re: 3D drawing in CADImport

Posted: 12 Dec 2008, 17:08
by lolena1888
Yes,
I have on the screen some kind of zooming window with some entities f.ex. blocks in it...

And the question connected to this task - can I change some properties (color, size, etc...) for the entire block. I have seen these properties for the block entity, but it doesn't seem to perform the task or it is redrawing it every time with the original ones...

Re: 3D drawing in CADImport

Posted: 15 Dec 2008, 16:57
by support
CADInsert and some other entities which contain Extrusion method are allowed to be rotated within a drawing respectively to the other entities.
And the question connected to this task - can I change some properties (color, size, etc...) for the entire block. I have seen these properties for the block entity, but it doesn't seem to perform the task or it is redrawing it every time with the original ones...
If you change properites of a block it changes automatically everywhere it is inserted.

Sergey.