LEADTOOLS Support
Document
Document SDK Questions
Re: Retieving Units information From DXF, DWG files
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, September 23, 2010 6:11:20 AM(UTC)
Groups: Registered
Posts: 1
Hello, I am evaluating LEADTOOLS 17 and loading some DXF files. Neither the GetUnits command nor the FileInfo structure used to load the file gives the correct units information. They both return the Units as pixels through the DXF file shows the INSUNITS field as inches.
Is there something that I am missing?
#2
Posted
:
Sunday, September 26, 2010 6:04:25 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
If you are referring to our L_VecGetUnit() function, this will return the global unit being used in our vector toolkit. It does not represent the units of any particular file.
If you want the units in the drawing to be in inches after it's loaded into LEADTOOLS, you can specify that using the L_VecSetUnit() function.
Currently, there is no way in LEADTOOLS to query a DXF file to find what units are stored in it.
#3
Posted
:
Monday, October 18, 2010 4:22:54 AM(UTC)
Groups: Registered
Posts: 1
<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/SupportPortal/CS/Themes/default/images/icon-quote.gif"> <strong>Steve Saban wrote:</strong></td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4">Hello, I am evaluating LEADTOOLS 17 and loading some DXF files. Neither the GetUnits command nor the FileInfo structure used to load the file gives the correct units information. They both return the Units as pixels through the DXF file shows the INSUNITS field as inches. Is there something that I am missing?</td></tr></table></td></tr></table></BLOCKQUOTE>
Steven,
I recently had this same question myself and took me some time to figure it out.
The $INSUNITS variable is not related to the unit of the CAD file as I also had originally thought; come to find out, in a technical sense, DXF and DWG files are unitless in nature. $INSUNITS relates to a default scale for blocks/inserts placed on the sketch, or, to quote some documentation:
"Specifies a drawing-units value for automatic scaling of blocks, images, or xrefs inserted or attached to a drawing."
The default unit for a newly created VECTORHANDLE is VECTOR_UNIT_PIXELS so unless you specifically change it yourself, that's what you will always get back. The only reason I have found to change it myself was so that calls to L_VecConvertPointToUnit would work, as it converts from the VECTORHANDLE's unit to the passed unit.
If, judging by your original post, you are trying to find the unit value of a DXF file, the answer is you'll have to ask the creator of the particular file, as there is no value for it in the DXF.
LEADTOOLS Support
Document
Document SDK Questions
Re: Retieving Units information From DXF, DWG files
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.