Assigning entities

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

Moderators: SDS, support, admin

Post Reply
aby
Posts: 81
Joined: 21 May 2007, 13:02
Location: Turkey

Assigning entities

Post by aby » 28 Feb 2008, 11:51

Hi,

I'm trying to copy entities from one drawing to another. I'm selecting entities from one drawing, pressing a button, then it copies selected entities to the new drawing. So far so good everything is fine. But I have some problems.

Here are the problems that I'm encountering.

1) The copied entities could not be selected. The newly created TsgDXFImage objects GetPoint method is returning (0,0) point. It can not transform the world coordinates to device coordinates.

TPoint vTL = FDXFImg->GetPoint(Entity->Box.TopLeft);

vTL is (0,0). This is very important. How can I impose the transformation. What can be done?

2) Some lines has different linetypes. For example a dashdot linetype. Although I'm adding the LType to the new Converter as shown in the following, linetypes are still "Continous". What am I missing?

DXFConverter->Sections[csLTypes]->AddEntity(LType);

3) It seems Hatch entities are copied but not displayed. Why?


Thanks

Aby

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

Post by support » 29 Feb 2008, 17:45

Hi,

<ol type="1">
<li>As far as we know you use <b>CAD Import VCL v.6.1</b>. This version contains just basis for copying entities. That is why sometimes an inaccuracy may happen while copying an entity from one TsgDXFImage object in to another.
BTW: the following line:

Code: Select all

TPoint vTL = FDXFImg->GetPoint(Entity->Box.TopLeft);
will work correctly only if an image has been drawn though once.</li>
<li>Adding a linetype object is not enouph. It must be assinged to an entity. It is necessary to use TsgDXFEntity->SetLType().</li>
<li>Hatch is a very complicated entity itself. That is why it is necessary to consider every concrete case.</li></ol id="1">
Sergey.

Please post questions to the forum or write to support@cadsofttools.com

aby
Posts: 81
Joined: 21 May 2007, 13:02
Location: Turkey

Post by aby » 29 Feb 2008, 19:15

Hi Sergey,

Thanks for you posts.

" TPoint vTL = FDXFImg->GetPoint(Entity->Box.TopLeft);

will work correctly only if an image has been drawn though once."

How can an Image cannot be drawn though once? What does it mean.
I am drawing the entities as shown in the following.

DXFImg->GetExtents();
DwgNavigator->Picture->Graphic = DXFImg;
DwgNavigator->FitToSize();
Form->Show();

My questions was and is .
What can be <b>done</b>?
How can I restart the transformation?
Is it possible to select the newly created entities or not?

Aby

aby
Posts: 81
Joined: 21 May 2007, 13:02
Location: Turkey

Post by aby » 01 Mar 2008, 15:07

"Adding a linetype object is not enouph. It must be assinged to the an entity. It is necessary to use TsgDXFEntity->SetLType()."



Even if you use DXFEntity->SetLType(), line is drawn continously.

You shouldn't have to call SetLType() function, Assign function is and must call the SetLType. SetLType is called because, debugger tells so.

Try a little program, you'll replicate this bug.

Thanks

Aby

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

Post by support » 05 Mar 2008, 10:09

Hi,

<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I am drawing the entities as shown in the following.

Code: Select all

DXFImg->GetExtents();
DwgNavigator->Picture->Graphic = DXFImg;
DwgNavigator->FitToSize();
Form->Show();
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
This code will work:

Code: Select all

TsgDXFImage *FImg = dynamic_cast<TsgDXFImage *> (DwgNavigator->Picture->Graphic);
FImg->GetPoint();
This code will not work:

Code: Select all

DXFImg->GetPoint()
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Is it possible to select the newly created entities or not?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Newly created entities must be available for selection by definition.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Even if you use DXFEntity->SetLType(), line is drawn continously.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
It must be a visualization problem. Try to change DXFEntity->LineTypeScale parameter.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">You shouldn't have to call SetLType() function, Assign function is and must call the SetLType. SetLType is called because, debugger tells so.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
When you call Assign function to copy an entity from the one CAD image to another, a reference is being copied only. So, an exception will arise when source CAD image is deleted. That is why linetype object must be recreated in the destination CAD image.

Sergey.

Please post questions to the forum or write to support@cadsofttools.com

aby
Posts: 81
Joined: 21 May 2007, 13:02
Location: Turkey

Post by aby » 05 Mar 2008, 15:35

<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />Hi,

<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I am drawing the entities as shown in the following.

Code: Select all

DXFImg->GetExtents();
DwgNavigator->Picture->Graphic = DXFImg;
DwgNavigator->FitToSize();
Form->Show();
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
This code will work:

Code: Select all

TsgDXFImage *FImg = dynamic_cast<TsgDXFImage *> (DwgNavigator->Picture->Graphic);
FImg->GetPoint();
This code will not work:

Code: Select all

DXFImg->GetPoint()
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Is it possible to select the newly created entities or not?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Newly created entities must be available for selection by definition.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Even if you use DXFEntity->SetLType(), line is drawn continously.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
It must be a visualization problem. Try to change DXFEntity->LineTypeScale parameter.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">You shouldn't have to call SetLType() function, Assign function is and must call the SetLType. SetLType is called because, debugger tells so.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
When you call Assign function to copy an entity from the one CAD image to another, a reference is being copied only. So, an exception will arise when source CAD image is deleted. That is why linetype object must be recreated in the destination CAD image.

Sergey.

Please post questions to the forum or write to support@cadsofttools.com
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

Post Reply