For example: if I draw the triangles with the 3D view activated and the 2D view deactivated, the image is not reflected at the end of the process of drawing the triangles (the number of triangles varies with the type of model, from a few hundred to a few thousand). The 2D view must be activated first and then switch to the 3D view to activate the first refresh of the drawing.
Code: Select all
//Drawing process
dwgForm.dwg3DView.BeginUpdate; //different attempts, it can be use or both
dwgForm.dwg2DView.BeginUpdate; //different attempts, it can be use or both
dwgForm.OnProgress:= OnProgress; does not affect the drawing speed
DrawIfcModel(FIfcModel); //process of generating the triangles on the image
//canceled as it does not help with drawing speed
//dwgForm.DwgCADImage.RefreshCurrentLayout;
//dwgForm.dwg2DView.FitToSize;
dwgForm.SetViewer; //Process to change from 2D view to 3D view
dwgForm.dwg2DView.EndUpdate;
dwgForm.dwg3DView.EndUpdate;
Code: Select all
//dwgForm.SetViewer //Process to change from 2D view to 3D view
if sCadImage = nil then Exit;
try
if not dwg3DView.Visible then
begin
dwg3DView.Visible := True;
dwg2DView.Visible := False;
if dwg3DView.Empty then
begin
try
Screen.Cursor := crHourGlass;
dwg3DView.LoadFromConverter(sCadImage.Converter, sCadImage);
finally
Screen.Cursor := crDefault;
end;
end
else
LoadViewFromCADImage(sCadImage, dwg3DView);
end;
if dwg3DView.ShowingStyle <> AStyle then
dwg3DView.ShowingStyle := AStyle;
HideOrbit3D;
except on E: Exception do
end;
The code comes from one examples of your library.
Test1: Draw the triangles in the image with the Visible 3D view (3DNavigator) and the hidden 2D view (Visible = False). When finishing the tracing of the triangles, the view does not show anything, it is empty, we proceed to show the 2D view and hide the 3D view, the application is blocked for almost a minute and finally shows the top view of the drawing (vTop), we proceed to activate the 3D view to visualize the model in perspective, the application is blocked while the view is refreshed and after 15 minutes must be suspended, completely blocked.
Test2: We proceed to draw the triangles with the visible 2D view and the hidden 3D view (Visible = False), the drawing process takes a normal time less than one minute but, when the application executes the code to activate the 3D view the application is blocked (not responding), again and after more than 10 minutes, hopefully the 3D view is shown.
Between 2 to 3 times out of 10 there is luck and it is possible to show the model in 3D visualization.
In question to the colors of the triangles, it is not a problem of card or user memory or something similar. The following image is from the same application, the same code, that I have done in Visual Studio with C # and C ++ code, separately, and both give me the same result, the colors are even, as it should be, see image.

- Triangles Colors2.PNG (38.4 KiB) Viewed 32543 times
The color assignment is made on the layers and not on the triangles, therefore all the triangles of the same layer have the same color. The triangles are grouped in several blocks that are assigned to the same layer, that is, in a layer there can be 2 or 20 blocks with a different number of triangles in them.
The triangle is created and associated with an active block, then the active block is associated with a new DXFInsert and the latter is associated with the image.