Page 1 of 1
Add another 3D object to the current scene
Posted: 28 Jan 2015, 10:52
by MikeD
Hi,
I am able to load .dxf and .stp/.step files into my Delphi 3D viewer.
Is there a way to add a second object into the scene without losing the already existing one?
-Mike
Re: Add another 3D object to the current scene
Posted: 28 Jan 2015, 17:18
by support
Hello Mike,
What 3D objects do you want to add? CAD VCL allows to add DXF entities (LINE, POLYLINE, ARC, CIRCLE, ELLIPSE, etc.) programmatically in 2D Wireframe mode.
Mikhail
Re: Add another 3D object to the current scene
Posted: 28 Jan 2015, 17:59
by MikeD
Hi Mikhail,
I have a DXF-object in the scene but want to load another one into the same scene so I have two DXF-objects.
Is that possible?
-Mike
Re: Add another 3D object to the current scene
Posted: 28 Jan 2015, 19:07
by support
Hello Mike,
Yes, it is possible. You have to create DXF entity programmatically, add it into TsgDXFConverter, then reload the scene using Tsg3DDrawingNavigator.LoadFromConverter method. Please, specify which DXF entities do you want to add.
Mikhail
Re: Add another 3D object to the current scene
Posted: 29 Jan 2015, 11:37
by MikeD
Hi Mikhail,
I did exactly what you said and it works perfectly.
Thanks for the great help
-Mike
Re: Add another 3D object to the current scene
Posted: 26 Aug 2015, 16:35
by Tiago.Rodrigues
Hi! Could you show more in detail the required code to achieve this?
Re: Add another 3D object to the current scene
Posted: 31 Aug 2015, 13:40
by support
Hello Tiago,
The following procedure creates a new line (TsgDXFLine) and adds it into TsgDXFConverter:
Code: Select all
procedure AddLine(ACADImage: TsgCADImage);
var
vLine: TsgDXFLine;
begin
vLine := TsgDXFLine.Create;
vLine.Point := MakeFPoint(300.0, 400.0, 0);
vLine.Point1 := MakeFPoint(760.0, 530.0, 0);
ACADImage.CurrentLayout.AddEntity(vLine);
if Assigned(ACADImage.Converter.OnCreate) then
ACADImage.Converter.OnCreate(vLine);
ACADImage.Converter.Loads(vLine);
ACADImage.GetExtents;
end;
Thus, you add a new DXF entity to the converter, then reload all the entities from the converter into the scene:
Code: Select all
AddLine(vCADImage);
F3DN.LoadFromConverter(vCADImage.Converter, vCADImage);
Mikhail