DWF

Reply
New Member
tragavendraraj
Posts: 2
Registered: ‎11-15-2007
Message 1 of 4 (121 Views)

How to add properties to WT_Polygon Object ?

121 Views, 3 Replies
11-15-2007 12:34 AM
Hi All,

I want to add properties to the WT_Polygon object.
Please help me in this.

Thanks in advance.

Regards
Raga
*Jeffrey Klug \(Autodesk\)
Message 2 of 4 (121 Views)

Re: How to add properties to WT_Polygon Object ?

11-15-2007 06:04 PM in reply to: tragavendraraj
Are you using the DWF toolkit? Check out the various samples therein. We
worked hard to provide good examples of many facets of publishing DWF data.
There are publishing samples in the toolkit which show how objects are
created and how properties are associated with objects. Good luck.

--
Jeffrey Klug
Sr. Software Engineer
Extended Design Group
Autodesk, Inc.


wrote in message news:5778289@discussion.autodesk.com...
Hi All,

I want to add properties to the WT_Polygon object.
Please help me in this.

Thanks in advance.

Regards
Raga
New Member
tragavendraraj
Posts: 2
Registered: ‎11-15-2007
Message 3 of 4 (121 Views)

Re: How to add properties to WT_Polygon Object ?

11-15-2007 08:54 PM in reply to: tragavendraraj
Hi Jeffery,

Thanks for your reply.

The DWF Toolkit publishing samples are using DWFFile class. But I am using WT_File class. Using the WT_Polygon class am creating the polygon objects in the DWF file.
Also there are many layers in the file.
Please check the below code and suggest me how to add properties to the object if I use the WT_File and WT_Polygon classes for creating the Polygon objects.

CODE:
--------

int i=0;
int j=0;
int k=0;
int x=0;
int y=0;
char layerName[20];
WT_File whip_file;
WT_Logical_Point rect[5];
WT_Layer current_layer;
// WT_Polygon rect_polygon;
//WT_Polyline dml;
WT_Color previous_color;
try
{
//Set the filename and open mode.
whip_file.set_filename ("mines.dwf");
whip_file.set_file_mode (WT_File::File_Write);
//Set a different target version here if you don't want the current file version... for example:
//whip_file.heuristics().set_target_version(42); //produce a DWF ver 00.42

if (WT_Result::smileyfrustrated:uccess == whip_file.open())
{
//Set the binary data and compression settings.
//whip_file.heuristics().set_allow_binary_data(true);
//whip_file.heuristics().set_allow_data_compression(true);
//whip_file.desired_rendition().color() = WT_Color (255,0,0);

//Store the current layer.
current_layer = whip_file.desired_rendition().layer();



for(i=1;i<=layerCount;i++)
{
x=0;
y=0;

sprintf(layerName,"Layer %d",i);
whip_file.desired_rendition().layer() = WT_Layer(whip_file,i,layerName);
for(j=0;j<5;j++)
{
for(k=0;k<5;k++)
{
rect[0] = WT_Logical_Point(x,y);
rect[1] = WT_Logical_Point(x+10,y);
rect[2] = WT_Logical_Point(x+10,y+10);
rect[3] = WT_Logical_Point(x,y+10);
rect[4] = WT_Logical_Point(x,y);
//Create the polygon.
WT_Polygon rect_polygon(4, rect, WD_True); WT_Polyline dml(5, rect, WD_True);

//Serialize.
WD_CHECK(rect_polygon.serialize(whip_file));

previous_color = whip_file.desired_rendition().color();
whip_file.desired_rendition().color() = WT_Color (255,0,0);
WD_CHECK(dml.serialize(whip_file));
whip_file.desired_rendition().color() = previous_color;
y=y+10;
}
y=0;
x=x+10;
}
}
//Restore the saved layer.
whip_file.desired_rendition().layer() = current_layer;
whip_file.close();

Regards
Raga
*Jeffrey Klug \(Autodesk\)
Message 4 of 4 (121 Views)

Re: How to add properties to WT_Polygon Object ?

11-20-2007 10:34 AM in reply to: tragavendraraj
Properties / meta-data are part of the DWF package format introduced in DWF
version 6. "Classic DWFs" or "W2D" resource streams do not contain
properties for graphic objects. You must create a DWF 6+ package using the
DWFFile / publishing classes in order to associate XML properties with
graphics. Hope that helps clear things up.

--
Jeffrey Klug
Sr. Software Engineer
Extended Design Group
Autodesk, Inc.


wrote in message news:5779289@discussion.autodesk.com...
Hi Jeffery,

Thanks for your reply.

The DWF Toolkit publishing samples are using DWFFile class. But I am using
WT_File class. Using the WT_Polygon class am creating the polygon objects in
the DWF file.
Also there are many layers in the file.
Please check the below code and suggest me how to add properties to the
object if I use the WT_File and WT_Polygon classes for creating the Polygon
objects.

CODE:
--------

int i=0;
int j=0;
int k=0;
int x=0;
int y=0;
char layerName[20];
WT_File whip_file;
WT_Logical_Point rect[5];
WT_Layer current_layer;
// WT_Polygon rect_polygon;
//WT_Polyline dml;
WT_Color previous_color;
try
{
//Set the filename and open mode.
whip_file.set_filename ("mines.dwf");
whip_file.set_file_mode (WT_File::File_Write);
//Set a different target version here if you don't want the current file
version... for example:
//whip_file.heuristics().set_target_version(42); //produce a DWF ver 00.42

if (WT_Result::smileyfrustrated:uccess == whip_file.open())
{
//Set the binary data and compression settings.
//whip_file.heuristics().set_allow_binary_data(true);
//whip_file.heuristics().set_allow_data_compression(true);
//whip_file.desired_rendition().color() = WT_Color (255,0,0);

//Store the current layer.
current_layer = whip_file.desired_rendition().layer();



for(i=1;i<=layerCount;i++)
{
x=0;
y=0;

sprintf(layerName,"Layer %d",i);
whip_file.desired_rendition().layer() = WT_Layer(whip_file,i,layerName);
for(j=0;j<5;j++)
{
for(k=0;k<5;k++)
{
rect[0] = WT_Logical_Point(x,y);
rect[1] = WT_Logical_Point(x+10,y);
rect[2] = WT_Logical_Point(x+10,y+10);
rect[3] = WT_Logical_Point(x,y+10);
rect[4] = WT_Logical_Point(x,y);
//Create the polygon.
WT_Polygon rect_polygon(4, rect, WD_True); WT_Polyline dml(5, rect,
WD_True);

//Serialize.
WD_CHECK(rect_polygon.serialize(whip_file));

previous_color = whip_file.desired_rendition().color();
whip_file.desired_rendition().color() = WT_Color (255,0,0);
WD_CHECK(dml.serialize(whip_file));
whip_file.desired_rendition().color() = previous_color;
y=y+10;
}
y=0;
x=x+10;
}
}
//Restore the saved layer.
whip_file.desired_rendition().layer() = current_layer;
whip_file.close();

Regards
Raga
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!