Block containing 3dSolid

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: support, SDS, admin

Post Reply
cmOdeon
Posts: 4
Joined: 08 Apr 2019, 11:23

Block containing 3dSolid

Post by cmOdeon » 09 Apr 2019, 17:10

Hi,

I am trying to create surface model using CAD VCL importer library for Delphi.
I am following the code in 3D Demo to access the entities in the model, but I found
some problems when dealing with Blocks containing 3dsolids.

Consider 2 different dxf models, The first one is a 3dsolid result of subtracting a prism
from a cylinder. The second one is a block containing only the previous 3dsolid.
Unfortunately I could not attach the models in this message, but You can get them here

https://we.tl/t-3Tue9dJjsN

The first model is displayed with no problems in the 3D demo. I can see the 3dsolid
is tessellated using triangles. However, the second model where we simple make a block
with the 3dsolid is not being displayed in the 3D demo (blank output), and in the code
the mesh of triangles is never reached.

So far I have had no problems with blocks. By using Autoinsert = TRUE, The entities
contained in the blocks somehow directly appear in the entity list with the correct
transformation matrix (FCADParams.ConvertMatrixCurrentInsertToWCS). What I am doing
wrong with 3dsolids?, is there a way to create a block containing 3dsolid entities?

I wonder if this meshing can be applied to other entities rather than 3dsolids?
In particular, can we create a mesh of triangles for a Region?

Best regards, Carlos.

support
Posts: 2930
Joined: 30 Mar 2005, 11:36
Contact:

Re: Block containing 3dSolid

Post by support » 12 Apr 2019, 00:00

Hello Carlos,

Attached you will find a sample DXF file created in AutoCAD 2010: we have created a parallelepipedic 3DSolid object, selected it and copied to the Clipboard along with a specified base point (COPYBASE command), pasted the copied object as a block in Model space (PASTEBLOCK command), then saved the drawing as an AutoCAD 2010 DXF file.

The CAD3D demo project displays the given DXF file correctly that means 3DSolid in a block can be displayed (at least when you create it in the above-described way). If you have used some other way to create the file Block3DSolid.dxf with AutoCAD, please describe it - it will help us to find the root of the problem.

Mikhail
Attachments
3dsolid_block_3dface.zip
AutoCAD 2010 DXF file containing a 3DSolid object pasted as a block using PASTEBLOCK command in AutoCAD 2010.
(9.01 KiB) Downloaded 66 times
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

cmOdeon
Posts: 4
Joined: 08 Apr 2019, 11:23

Re: Block containing 3dSolid

Post by cmOdeon » 12 Apr 2019, 10:41

Hi Mikhail,

Thanks for your answer,

I see that the Block defined in that way works fine in the 3D demo.
What I am doing to create blocks in Autocad and then insert them is as follows:

1.- Use BLOCK command -> window pops up where you name the block and select the objects
you want in the block (members can be other blocks) and a base point.
2.- Use INSERT command -> window pops up where you can select: the block you want to insert,
Insertion point, scale and rotation for the inserted copy of the Block.

This way of creating blocks and inserting them in Autocad, seems to work fine for 3D demo
when the members of the block are (lines, polylines, circles, arcs,... and blocks (made of the previous
entitytypes)) but when any of the members is a 3dSolid, then the 3dsolid is not displayed in 3D demo.
What is the problem?. See an example in the attachments. By the way I am using Autocad2019.

Could you please answer my second question?
Can be Regions triangulated as it is done for 3dsolids and Bodies?
Do you have a code snippet showing how to do this?

Best regards, Carlos.
Attachments
Block3DSolid_InsertedOnce.zip
(25.37 KiB) Downloaded 66 times

FieldConsult
Posts: 54
Joined: 14 Mar 2015, 22:33

Re: Block containing 3dSolid

Post by FieldConsult » 12 Apr 2019, 14:22

@cmOdeon

The problem lies in the routine of reading the DXF files because if you save your file in dwg format, the library reads the content and the 3D Demo shows the two cubes.

Cheers...

support
Posts: 2930
Joined: 30 Mar 2005, 11:36
Contact:

Re: Block containing 3dSolid

Post by support » 12 Apr 2019, 17:55

FieldConsult wrote:
12 Apr 2019, 14:22
@cmOdeon

The problem lies in the routine of reading the DXF files because if you save your file in dwg format, the library reads the content and the 3D Demo shows the two cubes.

Cheers...
You are partly right, because the problem depends on a version of the DXF format. For example, the file Block3DSolid_InsertedOnce.dxf is displayed in the 3D demo after resaving it in the DXF 2010 file format, while DXF 2013 and DXF 2018 versions of the same file give a blank screen.

Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

support
Posts: 2930
Joined: 30 Mar 2005, 11:36
Contact:

Re: Block containing 3dSolid

Post by support » 13 Apr 2019, 00:05

cmOdeon wrote:
12 Apr 2019, 10:41
Could you please answer my second question?
Can be Regions triangulated as it is done for 3dsolids and Bodies?
Do you have a code snippet showing how to do this?
Do you want to triangulate a 2D Region object?

Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

cmOdeon
Posts: 4
Joined: 08 Apr 2019, 11:23

Re: Block containing 3dSolid

Post by cmOdeon » 13 Apr 2019, 19:54

RegionSquareWithHole.zip
(22.87 KiB) Downloaded 70 times
@ FieldConsult, @Mikhail

Thanks!. Yes, you are right. It works fine for DWG and dxf2010, but not for dxf2013 and 2018. Maybe that can help to locate the problem.

@Mikhail

My second questions regards regions as the one in the attachment. The Model contains
just one Region entity representing a quadrilateral with a hole that is made as follows:

1) Create outer quadrilateral (as polyline) and converted to region using REGION command.
2) Same thing with inner quadrilateral
3) Use SUBTRACT command for the final region entity.

When input this model in the 3D demo, I see the first entity is a region and the following 8 entities are lines corresponding to the edges of the quadrilaterals (conveniently ordered forming closed loops). I checked this same List of entities is generated for all dxf format versions and DWG aswell.

I would like to know if is possible to triangulate a region entity as it is done with 3dsolids. Such that instead of this 8 lines we have a mesh of triangles in the list of entities.

Best regards

support
Posts: 2930
Joined: 30 Mar 2005, 11:36
Contact:

Re: Block containing 3dSolid

Post by support » 16 Apr 2019, 22:10

cmOdeon wrote:
13 Apr 2019, 19:54
I would like to know if is possible to triangulate a region entity as it is done with 3dsolids. Such that instead of this 8 lines we have a mesh of triangles in the list of entities.
Currently it is not possible.

Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

cmOdeon
Posts: 4
Joined: 08 Apr 2019, 11:23

Re: Block containing 3dSolid

Post by cmOdeon » 22 Apr 2019, 12:51

@Mikhail

Ok. Currently in the 3D demo AutoCAD regions appear in the entity list as a set of entities:
First one of type ceRegion marks the begining of the region, after that one we get a bunch
of ceLine entities representing the edges of the loops forming the planar region and finally an
ceEntity marking the end of the region.

I am assumming the Lines are given 'ordered' meaning that each line connects to previous one
unless it starts a new loop in which case the preceding Line had closed a loop. Is that right?.
If this is the case I can figure out how to create a Surface with that (because my goal is
create a surface model with the Geometry). However It would be great to have a mesh of triangles
rather than the lines since then a surface model for AUTOCAD regions would be straightforward.

I can see Autocad Surface(Planar) and Surface(Network) entities are converted to ceRegions
in the 3D demo.

Planar surfaces can be constructed using CONVTOSURF command in Autocad (see polyLineToPlanarSurface.dxf
in attachments). In this case the list of entities in 3D demo becomes: First a ceLWPolyLine followed
by a ceRegion entity with corresponding ceLines and ceEntity to finalize the region. So we end up
having duplicated information in the list of entities. Is there a way to identify the Polyline and
the region as part of the same AUTOCAD Surface?

NetworkSurfaces might be non-planar in which case they appear in the entity list of 3D demo as a
ceRegion Entity followed by ceSplines rather than ceLines, finally ceEntity closes the region.
I notice this Autocad entity appears blanck in the 3D demo, see OneSurfaceNetwork.dxf in attatchments.
Do you know how can I use ceSplines to construct a collection of planar surfaces that represents the
NetworkSurface?

Thank you for the help.
Best regards. Carlos.
Attachments
OneSurfaceNetwork.zip
(29.87 KiB) Downloaded 64 times
PolyLineToPlanarSurface.zip
(23.22 KiB) Downloaded 62 times

Post Reply