Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

VECTORTEXT
Started by Smoke at 04-21-2008 6:32. Topic has 8 replies.

Print Search « Previous Thread Next Thread »
  04-21-2008, 6:32
Smoke is not online. Last active: 8/13/2008 10:25:33 AM Smoke

Top 200 Posts
Joined on 03-23-2008
Posts 15
VECTORTEXT
Reply Quote
Hi,

I'm trying to develop simple test project with saving VECTORTEXT to DGN file, but is still doesn't work for me. The file is created, but when I open the file in any dgn viewer, it looks there is no object.
Here is my code:

static L_INT VecAddObjectExample2()
{
L_INT nRet;
VECTORHANDLE Vector;
VECTORTEXT Text;

/* Init the new object */
nRet = L_VecInit( &Vector );
if(nRet != SUCCESS)
return nRet;

VECTORLAYERDESC LayerDesc;
VECTORLAYER Layer;

// create layer
LayerDesc.nSize = sizeof( VECTORLAYERDESC );
lstrcpy( LayerDesc.szName, TEXT("My Layer"));
LayerDesc.bVisible = TRUE;
LayerDesc.bLocked = FALSE;
LayerDesc.dwTag = 0L;

nRet = L_VecAddLayer( &Vector, &LayerDesc, &Layer, VECTOR_FLAGS_RENAME_DUPLICATES );
if( nRet != SUCCESS)
return nRet;

/* Init the new object */
nRet = L_VecInitObject( &Text.Object );
if(nRet != SUCCESS)
return nRet;

Text.Object.nSize = sizeof( VECTORTEXT );
Text.pszText = TEXT("My Text");
Text.Point.x = 1.5;
Text.Point.y = 1.5;
Text.Point.z = 0;
Text.Point.lTag = 1;

Text.Font.nSize = sizeof( VECTORFONT );
Text.Pen.nSize = sizeof( VECTORPEN );
Text.Brush.nSize = sizeof( VECTORBRUSH );
Text.Font.nSize = sizeof( VECTORFONT );
lstrcpy( Text.Font.LogFont.lfFaceName, TEXT("Txt"));

Text.CharHeight = 10;
Text.CharWidth = 0;

Text.Font.LogFont.lfCharSet = 1;

Text.Object.nLayerId = 0;
Text.Pen.bExtPen = FALSE;
Text.Pen.NewPen.LogPen.lopnStyle = PS_SOLID;
Text.Pen.NewPen.LogPen.lopnWidth.x = 0;

Text.Brush.VectorBrushStyle = VECTORBRUSH_STANDARD;
Text.Brush.BrushType.StandardBrush.LogBrush.lbStyle = 1;
Text.Brush.BrushType.StandardBrush.LogBrush.lbColor = 0;
Text.Brush.BrushType.StandardBrush.LogBrush.lbHatch = 0;

/* add to current active layer */
nRet = L_VecAddObject ( &Vector, &Layer, VECTOR_TEXT, &Text, NULL );
if(nRet != SUCCESS)
return nRet;

/* save */
nRet = L_VecSaveFile(TEXT("x:\\testx2.dgn"), &Vector, FILE_INTERGRAPH_VECTOR, NULL );
if(nRet != SUCCESS)
return nRet;

return nRet;
}

What I'm doing wrong?

Thanks for your help.

Smoke
   Report 
  04-21-2008, 13:30
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: VECTORTEXT
Reply Quote
This is because we do not support saving text objects in the DGN file format.  For a list of the objects we support or don't support in loading and saving for a file format, please check the main Vector Help file and see the article for that particular format.  Usually, you will find this by typing the 3 letter extension into the index, e.g. "DGN" or "DXF".

Greg Ross
LEADTOOLS Technical Support
   Report 
  04-21-2008, 13:37
Smoke is not online. Last active: 8/13/2008 10:25:33 AM Smoke

Top 200 Posts
Joined on 03-23-2008
Posts 15
Re: VECTORTEXT
Reply Quote
But when I tried Vector.exe example, then DGN with text object was correctly saved. Why Vector.exe can save text object to DGN, but I cannot do it through API?

Thanks

Smoke
   Report 
  04-22-2008, 11:34
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: VECTORTEXT
Reply Quote
There's a few issues here, so read carefully.  I do need to report a few incidents, but nothing here should be show stopping because there was an error in your code that led to the discovery of other problems.

Good catch on the main API demo working, I've contacted our documentation team to fix this problem.  
 
Due to that, I've taken a closer look at your code snippet and if you save to other formats, it will fail with -506 which means "Invalid object type".  However, when saving to DGN, it returns success, but the object obviously doesn't exist in the file. 

As for your code, the problem is that you are not setting the VECTORTEXT.Object.nType property to VECTOR_TEXT.  When I did this, the file saved properly with the text object in it.  Additionally, you should memset the VECTORTEXT.Font.LogFont property to all zeros before you change any of the other properties:

memset(&Text.Font.LogFont, 0, sizeof(LOGFONTW));

For DGN, this didn't affect anything, but for formats that support rotated text and other formatting like DXF, it did alter the output.  I'm not sure if this is how it's designed, or if L_VecInitObject should be doing this for you.

In summary, I want to report three incidents for you:

1. documentation update for DGN
2. L_VecSaveFile returning SUCCESS when it shouldn't because of a bad object
3. inquiry into whether or not L_VecInitObject should be setting the VECTORTEXT.Font.LogFont property to zeros.

However, in order to do that I need you to send an email to support@leadtools.com including the following information:
 
1. The company you work for
2. The LEADTOOLS serial number(s) you own (if you are evaluating, just say so)
3. The name(s) of the developer(s) using the serial number
4. A link to this forum post


Greg Ross
LEADTOOLS Technical Support
   Report 
  04-23-2008, 2:14
Smoke is not online. Last active: 8/13/2008 10:25:33 AM Smoke

Top 200 Posts
Joined on 03-23-2008
Posts 15
Re: VECTORTEXT
Reply Quote
Thanks for your help :-)

Smoke
   Report 
  04-23-2008, 9:30
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: VECTORTEXT
Reply Quote
Below are the incidents and the issues reported in them:

6926IDT - Documentation update (Incorrect list of supported objects for DGN file format in vector help files)
6927IDT - L_VecSaveFile returns SUCCESS when it should return -506
6928IDT - L_VecInitObject doesn't initialize TEXTOBJECT.Font.LogFont

These incidents will be reviewed and prioritized by our engineering department.  I will contact you when I get more information from our developers.
 
If you have any more questions, please let me know.



Greg Ross
LEADTOOLS Technical Support
   Report 
  04-23-2008, 9:42
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: VECTORTEXT
Reply Quote
I almost forgot, but there was another incident related to 6927IDT which I also reported.  It seemed more logical for -506 to be returned when adding the object with L_VecAddObject than L_VecSaveFile.  This incident number is 6929IDT.
Greg Ross
LEADTOOLS Technical Support
   Report 
  06-03-2008, 10:04
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: VECTORTEXT
Reply Quote
I've gotten an update from the developers working on your incident, 6928IDT.  They have told me that not initializing the font structure is by design and that you are responsible for calling memset on it.  The reasoning here is that L_VecInitObject is designed to initialize just the VECTOROBJECT which is a part of a larger object, in this case VECTORTEXT.  L_VecInitObject doesn't know or care what the larger object is, only the VECTOROBJECT within it.

They might add another function, but since there's a viable workaround it is still up in the air.  I will contact you if I get any  more information regarding this incident.
Greg Ross
LEADTOOLS Technical Support
   Report 
  07-24-2008, 15:51
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: VECTORTEXT
Reply Quote
The documentation incident, 6926IDT, has been fixed and the latest versions of the pertinent articles can be found here:

http://www.leadtools.com/Help/LEADTOOLS/v15/Vector/API/Dllaux/DGNFmt.htm
http://www.leadtools.com/Help/LEADTOOLS/v15/Vector/CLIB/Dllaux/DGNFmt.htm
 
http://www.leadtools.com/Help/LEADTOOLS/v15/Main/API/Dllaux/DGNFmt.htm
http://www.leadtools.com/Help/LEADTOOLS/v15/Main/CLIB/Dllaux/DGNFmt

Your other incidents, 6927IDT and 6929IDT, have been fixed.  Please send an email to support@leadtools.com in order to get the download instructions for the latest patch.  For verification purposes, I need you to include the following information:

1. The company you work for
2. The LEADTOOLS serial number(s) you own (if you are evaluating, just say so and we'll send you the eval patch)
3. The name(s) of the developer(s) using the serial number
4. A link to this forum post

Greg Ross
LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » Developer » Vector » VECTORTEXT

Powered by Community Server, by Telligent Systems