DWF

Reply
Member
sumannelson
Posts: 3
Registered: ‎04-22-2007
Message 11 of 22 (256 Views)

Re: DWF geometry data

05-02-2007 12:06 AM in reply to: bejn
Oh! I will try that.

Thank you very much!
Suman
Contributor
chandru.pachai
Posts: 12
Registered: ‎04-24-2007
Message 12 of 22 (256 Views)

Re: DWF geometry data

05-24-2007 03:12 AM in reply to: bejn
So the code realy helped me a lot in understanding DWF implementation.

please Show me the examples of implementation of all the callback classes for different objects in dwf.

my requirements is simply i have write all the geometric properties and other physical properties(like color, line pattern, fill details etc...) into a XML or txt file.

please can any one help me out. how i can explore the geometry data for the polyline, polygon, circle etc.. using code samples.

how i could implement the execute functions for different objects with sample for callbacks set to SetOpcodeHandler.

i have used similar kind of approach for exploring the W3d files.

when i view the dwf file in the viewer. i found lot of poly lines, but while debuging its not executing the callbacks in the polyline class.

please send some code from which i understand them...

Thanks in Advance
Chandru.P
Valued Contributor
jasona
Posts: 55
Registered: ‎12-01-2005
Message 13 of 22 (256 Views)

Re: DWF geometry data

05-24-2007 09:47 PM in reply to: bejn
Following is some code I quickly put together to help you understand.

I have made the simple example print to a opengl context, but you must decide on how you want to best use the data, ie opengl, directx, database storage, calcualation, scenegraph storage etc....

As for all the other types of handlers, you simply read the hoops documentation for all the gory bits and read through the header files on how you should parse them.

Hope this helps
Jason Anderssen

TK_Status CPolyLineHndlr::Execute( BStreamFileToolkit &parser) {
TK_Status status = TK_Polypoint::Execute(parser);
if (status != TK_Normal){
return status;
}

glBegin(GL_LINE_STRIP);
for( int i = 0; i < m_count; i++ ) {
glVertex3d(m_points[i * 3], m_points[i*3+1], m_points[i*3+2]);
}
glEnd();

return status;

}
Contributor
chandru.pachai
Posts: 12
Registered: ‎04-24-2007
Message 14 of 22 (256 Views)

Re: DWF geometry data

05-24-2007 10:20 PM in reply to: bejn
thanks yaar. I will study and if i have any problem. i will get back to you.

My application is just to read all the geometric data and object properties of each object and put them in organised XML file.

i don't realy need to work on any thing else.

there where i am struck. can u help me in reading all the geometric and other properties of different objects like line, poly line, polygon, circle...

I have wriitten the my application in which i obtained the 3d stream and implemented all the class and setopcodehandler, but i am struck with reading the geomentic properties of each objects. (how i should go head in customizing the classes). i didn't find any help on the web.

i realy not needed to work with the obtained data. the XML file will serve as a input for other software.

my xml will have oly properties like color, points, line pattern, block details.

i use autocad to export the 3d dwf.

could u help me with some code sample...

Thanks and regards,
Chandru.P
Valued Contributor
jasona
Posts: 55
Registered: ‎12-01-2005
Message 15 of 22 (256 Views)

Re: DWF geometry data

05-24-2007 10:40 PM in reply to: bejn
I would seriously re-consider xml'ing the file, as you will end up with a huge file in the case of very large drawings.

eg, if a library object, that consists of 300 different objects, is pasted 300 different times, you will have to either make your file 300 * 300 times bigger, or re-do what autocad has already designed to be an effecient method.

Anyhow, if you would like any assistance with your code, email me at janderssen@gmail.com and I will try and assist where I can. I wont help with algorithms like how to draw a circle etc. you have to figure this stuff out yourself, but I will help where I deem it a bit difficult to understand.

Cheers
Jason Anderssen
Contributor
chandru.pachai
Posts: 12
Registered: ‎04-24-2007
Message 16 of 22 (256 Views)

Re: DWF geometry data

05-24-2007 11:02 PM in reply to: bejn
Yes I understand that it result in huge file. but the requirement is in such way.

i have read only the existing objects property.

i have nothing to create with DWF. i have to explore all object properties.

thanx,
Chandru.p
Contributor
chandru.pachai
Posts: 12
Registered: ‎04-24-2007
Message 17 of 22 (256 Views)

Re: DWF geometry data

06-21-2007 02:48 AM in reply to: bejn
Hi,

I have small proplem in getting the polyline points. that
on calling the m_pW2DStrm->process_next_object();
it goes to the callback function of poly line where i retrive the points it give the junk values as follows
Number of Points = 5
X0 = 2147475881 Y0 = 3540
X1 = 2147476920 Y1 = 3540
X2 = 2147476920 Y2 = 4201
X3 = 2147475881 Y3 = 4201
X4 = 2147475881 Y4 = 3540

The code i used for getting the values is
WT_Result CWhipHndlr::smileytongue:rcsPolyLine ( WT_Polyline &pPolyline, WT_File & file )
{
WT_Result res = WT_Result::Unknown_File_Read_Error;
if (m_pDwf2DStrm)
{
fout<<""< int color_index = file.rendition().color().index();
WT_RGBA32 fdf = file.rendition().color().rgba();
fout<<"\t\tColor Index = \""<<<"\"\tRed = \""<<(int)fdf.m_rgb.r<<"\"\t Blue = \""<<(int)fdf.m_rgb.b<<"\"\t Green = \""<<(int)fdf.m_rgb.g<<"\"\t Alpha = \""<<(int)fdf.m_rgb.a<<"\""< int iCount = pPolyline.count();
fout<<"\t\t\tNumber of Points = "< WT_Logical_Point *pPoints = new WT_Logical_Point();
pPoints=pPolyline.points();
for(int i =0;i {
fout<<"\t\t\t\tX"<<<" = "<.m_x<<"\t Y"<<<" = "<.m_y< }
fout<<"
"<<"\t\t";
res = WT_Result::smileyfrustrated:uccess;
}


if u see other values are correct.

onthing i noticed on debugging instead of calling the Process m_pW2DStrm->process_next_object(); if i call the m_pW2DStrm->get_next_object(); and using the following code in the switch case

case WT_Object::smileytongue:olyline_ID:
{fout<<"Polyline_ID"< WT_File pFile;
WT_Polyline* pPoly = (WT_Polyline*) pObj;
fout<<"\t\t\tNumber of Points = "<count()<points();
for(int i =0;icount();i++)
{
fout<<"\t\t\tX"<<<" = "<.m_x<<"\t Y"<<<" = "<.m_y< }
break;}
return res;
}

i get the correct values as follows
Number of Points = 5
X0 = -1039 Y0 = -661
X1 = 0 Y1 = -661
X2 = 0 Y2 = 0
X3 = -1039 Y3 = 0
X4 = -1039 Y4 = -661

Can u Help me so that i use the call back way of approaching the Objects please... I am not able to find the mistake i have comitted.

Thanks in Advance
Chandru.P
Contributor
chandru.pachai
Posts: 12
Registered: ‎04-24-2007
Message 18 of 22 (256 Views)

Re: DWF geometry data

06-21-2007 02:50 AM in reply to: bejn
Hi,

I have small proplem in getting the polyline points. that
on calling the m_pW2DStrm->process_next_object();
it goes to the callback function of poly line where i retrive the points it give the junk values as follows
Number of Points = 5
X0 = 2147475881 Y0 = 3540
X1 = 2147476920 Y1 = 3540
X2 = 2147476920 Y2 = 4201
X3 = 2147475881 Y3 = 4201
X4 = 2147475881 Y4 = 3540

The code i used for getting the values is
WT_Result CWhipHndlr::smileytongue:rcsPolyLine ( WT_Polyline &pPolyline, WT_File & file )
{
WT_Result res = WT_Result::Unknown_File_Read_Error;
if (m_pDwf2DStrm)
{
fout<<""< int color_index = file.rendition().color().index();
WT_RGBA32 fdf = file.rendition().color().rgba();
fout<<"\t\tColor Index = \""<<<"\"\tRed = \""<<(int)fdf.m_rgb.r<<"\"\t Blue = \""<<(int)fdf.m_rgb.b<<"\"\t Green = \""<<(int)fdf.m_rgb.g<<"\"\t Alpha = \""<<(int)fdf.m_rgb.a<<"\""< int iCount = pPolyline.count();
fout<<"\t\t\tNumber of Points = "< WT_Logical_Point *pPoints = new WT_Logical_Point();
pPoints=pPolyline.points();
for(int i =0;i {
fout<<"\t\t\t\tX"<<<" = "<.m_x<<"\t Y"<<<" = "<.m_y< }
fout<<"
"<<"\t\t";
res = WT_Result::smileyfrustrated:uccess;
}


if u see other values are correct.

onthing i noticed on debugging instead of calling the Process m_pW2DStrm->process_next_object(); if i call the m_pW2DStrm->get_next_object(); and using the following code in the switch case

case WT_Object::smileytongue:olyline_ID:
{fout<<"Polyline_ID"< WT_File pFile;
WT_Polyline* pPoly = (WT_Polyline*) pObj;
fout<<"\t\t\tNumber of Points = "<count()<points();
for(int i =0;icount();i++)
{
fout<<"\t\t\tX"<<<" = "<.m_x<<"\t Y"<<<" = "<.m_y< }
break;}
return res;
}

i get the correct values as follows
Number of Points = 5
X0 = -1039 Y0 = -661
X1 = 0 Y1 = -661
X2 = 0 Y2 = 0
X3 = -1039 Y3 = 0
X4 = -1039 Y4 = -661

Can u Help me so that i use the call back way of approaching the Objects please... I am not able to find the mistake i have comitted.

Thanks in Advance
Chandru.P
*Jos Groot Lipman
Message 19 of 22 (256 Views)

Re: DWF geometry data

06-21-2007 03:32 AM in reply to: bejn
X0 = 2147475881 Y0 = 3540

The coordinates look perfectly fine to me. These are Whip coordinates which
can range from anywhere between MIN_INT to MAX_INT. For some obscure reason
AutoCAD always generates DWF coordinates with the X-value very close to
MAX_INT.
You have to use a units.transform function to translate the coordinates back
to the original AutoCAD DWG coordinates. Before doing that there is no way
to tell if the coordinates are 'junk'.

Jos Groot Lipman
Contributor
chandru.pachai
Posts: 12
Registered: ‎04-24-2007
Message 20 of 22 (256 Views)

Re: DWF geometry data

06-21-2007 03:37 AM in reply to: bejn
One thing i noticed on debugging instead of calling the Process m_pW2DStrm->process_next_object(); if i call the m_pW2DStrm->get_next_object(); and using the following code in the switch case

case WT_Object::smileytongue:olyline_ID:
{fout<<"Polyline_ID"< WT_File pFile;
WT_Polyline* pPoly = (WT_Polyline*) pObj;
fout<<"\t\t\tNumber of Points = "<count()<points();
for(int i =0;icount();i++)
{
fout<<"\t\t\tX"<<<" = "<.m_x<<"\t Y"<<<" = "<.m_y< }
break;}
return res;
}

i get the correct values as follows
Number of Points = 5
X0 = -1039 Y0 = -661
X1 = 0 Y1 = -661
X2 = 0 Y2 = 0
X3 = -1039 Y3 = 0
X4 = -1039 Y4 = -661

Can u Help me so that i use the call back way of approaching the Objects please... I am not able to find the mistake i have comitted.

Thanks in Advance
Chandru.P
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.