高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】problems with creating hatch in dd1.12
problems with creating hatch in dd1.12
problems with creating hatch in dd1.12
hi,
the following code crashes in dd1.12 at setpattern,
it did not in 1.11 u1.
oddbhatchptr phatch = oddbhatch::createobject();
phatch->setassociative(true);
phatch->setpattern(oddbhatch::kpredefined , "angle");
if 'pblock->appendoddbentity(phatch);' is done before setpattern it will work ok. my guess is the phatch in above code not being in a database is causing this crash ?
// joakim elofsson
[edit:] using dd for vc2002ml
last edited by joakim elofsson; 13th october 2004 at 06:50 amfff">.
quote:
originally posted by joakim elofsson
hi,
the following code crashes in dd1.12 at setpattern,
it did not in 1.11 u1.
oddbhatchptr phatch = oddbhatch::createobject();
phatch->setassociative(true);
phatch->setpattern(oddbhatch::kpredefined , "angle");
if 'pblock->appendoddbentity(phatch);' is done before setpattern it will work ok. my guess is the phatch in above code not being in a database is causing this crash ?
// joakim elofsson
[edit:] using dd for vc2002ml
hi there,
the error occured may be because you dont have the .pat files..
the appendpattern will internally call the oddbhostappservices::findfile() to find the .pat file. if you using measurement as english/metric then it will search for acad.pat/acadiso.pat file
-----------------------
regards,
rajesh parameswaran
quote:
originally posted by joakim elofsson
my guess is the phatch in above code not being in a database is causing this crash ?
joakim, you're absolutely right.
to prevent this crash you can also call one of the following hatch members:
oddbentity::setdatabasedefaults(oddbdatabase* pdb = null);
oddbentity::copyfrom(const odrxobject* p);
sincerely yours,
george udov
i'm new to dd and found this happening in the odwriteex example. did i miss something trying to setup everything correctly, or should i fix the example sourcecode as suggested?
using visual studio..
thanks
jesper
jesper, most probably your problem is dd cannot find file acad.pat (or acadiso.pat). dd calls oddbhostappservices::findfile() to get full path to acad.pat. you can override findfile() in your oddbhostappservices inheritor.
sincerely yours,
george udov
george, thanks for fast reply. i took over findfile() as suggested, and it does actually search for a path to acad.pat. trouble is, i don't have the file - where to find it?
i have autocad lt 2004 installed, but the trytofindacad() method in the odwriteex example seem to fail finding it?
it seems like it's also trying to find paths to verdana.ttf, which i do have - guess it's installed with windows xp. did anywrite write a default oddbhostappservices class for windows (visual studio, or how am i best helped on this) ?
where can i read more on "getting started", the dwgdirect.chm is not all that helpful.. ?
thanks for listening
using a code trying to locate autocad installed on computer to get .pat file is dangerous in real application. it may work on developer's computer and will not work on your customer's computer. are you going to write in your release notes that your product requires autocad installed? redistributing "native" .pat files may cause copyright problems.
my suggestion is to create autocad's predefined patterns you need programmatically (see odwriteex sample). surely loading patterns from your own .pat files distributed with your application is safe from all points of view.
sergey slezkin
quote:
originally posted by sergey slezkin
are you going to write in your release notes that your product requires autocad installed?
no, i was just wonder what's going on in the odwriteex axample. now i realize that using hatches, acad may need a pat file..?
if you create a custom pattern and save a dwg file with hatch using it autocad will display the file correctly but if corresponding .pat file is absent the hatch will be not editable. predefined patterns will work ok because they are available to autocad from its own .pat file.
sergey slezkin
|