I came across a post from Frank Whaley that explained the same thing so I
tried to translate it to ARX. I'm having limited success. For some reason,
the call the acdbDictAdd always fails. To make things even more interesting,
ERRNO gets set to 1083. The highest value listed in ol_errno.h is 105. Go
figure. Here's the code I'm using (I'm usre the word wrapping will be simply
hideous). Lots of code omitted for brevity:
if (pDict->getAt("DWGPROPS", (AcDbObject*&) pDict, AcDb::kForRead) ==
Acad::eKeyNotFound)
{
struct resbuf* pRbList = NULL;
struct resbuf* pRbEdit = NULL;
struct resbuf* pRbCreated = NULL;
struct resbuf* pRbSaved = NULL;
ads_name xname, maindict;
char* dictName = "DWGPROPS";
pRbEdit = acutNewRb(AcDb::kDxfReal);
pRbCreated = acutNewRb(AcDb::kDxfReal);
pRbSaved = acutNewRb(AcDb::kDxfReal);
if (acdbGetAdsName(maindict, pDict->objectId()) != Acad::eOk)
return E_FAIL;
acedGetVar("TDINDWG", pRbEdit);
acedGetVar("TDCREATE", pRbCreated);
acedGetVar("TDUPDATE", pRbSaved);
pRbList = acutBuildList(RTDXF0 , "XRECORD",
100, "AcDbXrecord",
1, "DWGPROPS COOKIE",
2, "",
3, "",
4, "",
5, "",
6, "",
7, "",
8, "",
9, "",
300, "=",
301, "=",
302, "=",
303, "=",
304, "=",
305, "=",
306, "=",
307, "=",
308, "=",
309, "=",
40, pRbEdit->resval.rreal,
41, pRbCreated->resval.rreal,
42, pRbSaved->resval.rreal,
RTNONE);
if (acdbEntMakeX(pRbList, xname) != RTNORM)
return E_FAIL
// This fails every time.
if (acdbDictAdd(maindict, dictName, xname) != RTNORM)
return E_FAIL;
}
--
Attitudes are contagious. Is yours worth catching?
http://www.acadx.com
"Gary McMaster" wrote in message
news:7948AFB114BD198A7EB28F5B98798322@in.WebX.SaUCah8kaAW...
> Hi Frank,
>
> I had the same problem with props that had never been used with a VBA
> program. I cheated and used "sendcommand" to load some lisp to create it
if
> VBA returned an error. Its posted below if you don't mind hacking it like
I
> did.
>
> (setq xlist
> (list
> '(0 . "XRECORD")
> '(100 . "AcDbXrecord")
> '(1 . "DWGPROPS COOKIE")
> (cons 2 "IPETitle")
> (cons 3 "IPESubject")
> (cons 4 "IPEAuthor")
> (cons 6 "IPEComments")
> (cons 7 "IPEKeywords")
> (cons 8 (getvar "loginname"))
> (cons 9 "IPERevNo")
> (cons 300 "IPE Custom 1=Ftype")
> (cons 301 "IPE Custom 2=A")
> (cons 302 "IPE Custom 3=B")
> (cons 303 "IPE Custom 4=C")
> (cons 304 "IPE Custom 5=D")
> (cons 305 "IPE Custom 6=E")
> (cons 306 "IPE Custom 7=F")
> (cons 307 "IPE Custom 8=G")
> (cons 308 "IPE Custom 9=H")
> (cons 309 "IPE Custom 10=J")
> (cons 40 (getvar "TDINDWG"))
> (cons 41 (getvar "TDCREATE"))
> (cons 42 (getvar "TDUPDATE"))
> )
> )
>
> (dictadd (namedobjdict) "DWGPROPS" (entmakex xlist))
> (setq xlist nil)
>
> Gary
>