This is Nick Gorlov's Typepad Profile.
Join Typepad and start following Nick Gorlov's activity
Join Now!
Already a member? Sign In
Nick Gorlov
Recent Activity
is it working, like expected? I'm asking because if i use ЯЯЯ as UserId and appstore.exchange.autodesk.com:фыва as an AppId, full string will be: https://apps.exchange.autodesk.com/webservices/checkentitlement?userid=ЯЯЯ&appid=appstore.exchange.autodesk.com%3aфыва i got {"UserId":"ЯЯЯ","AppId":"appstore.exchange.autodesk.com:фыва","IsValid":false,"Message":"Ok"} as a result. 100% that there is no such AppId and UserId. if i use my UserId and appId of the free plugin, that i really downloaded, i got "IsValid":false,"Message":"Ok". so, for me Message is always = Ok, and IsValid is always = false. it doesnt depend on userId or appid at all. maybe it works only with paid apps, and i'll see {... "IsValid": true...} only if i'll buy an app and test this string with my UserId and AppId of the app i bought?
actually i didn't find a difference in broken block inserting between your and my code. that's why i started this conversation :). about workaround. problem is not in me, but in my users :). i teach em, that they have to use my mechanism for inserting blocks, but they prefere copy/paste :( "but I can't even take further as it got fixed in 2015 Sp2" - also there is no comments about this problem and its healing in sp2 documentation :) so, there were no problems at all :). anyway, thx for your help. by the way, if your code is able to fix draworder, why, after inserting block with your code i still can't copy/paste inserted block to a new drawing? :)
hm..., english is not my native language. "visual effect" was just a joke (looks like it was a bad joke :) ). sure the draworder must be correct if autocad draw the block correctly. your video doesn't show the most interesting part: what would be if you copy/paste this block into a new drawing. that's why my first message was:"this code is just for fun", because we can do nothing to fix autocad native behavior. also i wrote that your and my code do the same (insert block correctly into a drawing database), but it's not enough for blocks with broken draworder (or mb draworder is correct from the beginning? :):):) and just paste into a new drawing can break it?). i've found my old video for devhelp. it demonstrates an autocad native behavior in broken block creation :) https://yadi.sk/d/J1omau3Xcpa2d PS: may be it's possible to force the block to forget, that it was modified in block editor (mb class variables or something like this)? what is able to force autocad to kill correct draworder during copy/paste? PS2: If you prefer to continue the conversation via e-mail, i can :):):). there is no difference to me.
actually, the problem is not in dynamic parameters. here are some static blocks :) https://yadi.sk/d/Uug7VLqhcohNB the common for of all of these blocks is the block editor command. all of them were modified in block editor window (if _bedit was used just for adding params everything works fine, but if i draw something inside _bedit, 100% block will have a broken draworder for copy/paste into a new drawing). so, in my mind the problem is in source code of this command, but there is no proofs. and somehow autocad 2015 is now able to draw a correct draworder for a block with a broken one :)
ok. sure i can share one more dwg for you :) https://yadi.sk/d/A1utxOQKcodWD 1. open the drawing 2. select blocks 3. Ctrl+C 4. create a new drawing 5. Ctrl+V these blocks into the new drawing Try to do these steps in AutoCAD 2008-2014 (one of them. The results are the same) and in AutoCAD 2015+SP2. Feel the difference :) Talking about the code. My and your code is able to insert these blocks with a correct draworder (mb it's just a visual effect and the draworder is still broken, but it works), but native autocad commands become able to do this just several months ago. And autodesk keeps silence about the reasons of this behavior. How it happens? Is it possible to fix my own blocks? I still got no answer from their side (topic was started in December, 2013 :):):) )
actually, this code does nothing useful at all. if i have a block with a broken draworder, this code can't fix it. using code (your or mine) i can (almost 5 years i can) insert this block with a correct draworder. but then, if autocad will copy this block (Ctrl+C/Ctrl+V) to the new drawing, draworder become broken again. that's the real situation. it was fixed in Autocad 2015 SP2. but earler versions will live with this bug forever and this code can't fix it. so, this code is just for fun :) // your code AcDbObjectId importBlockToCurDWGDatabase(const ACHAR *pBlockName /*block name*/, const ACHAR *pFileName /*full path to the file with this block*/) { Acad::ErrorStatus es=Acad::eOk; AcDbObjectId idImported = AcDbObjectId::kNull; // output ID of our block in current database AcDbDatabase* pWorkDatabase = acdbHostApplicationServices()->workingDatabase(); AcAxDocLock docLock(pWorkDatabase); AcDbDatabase* pBlockDatabase = new AcDbDatabase(false,true); es = pBlockDatabase->readDwgFile(pFileName); if(es!=Acad::eOk){delete pBlockDatabase;return NULL;} try { AcDbBlockTable* pBlockTable, *pBlockTable2; es=pBlockDatabase->getSymbolTable(pBlockTable,AcDb::kForRead); if(es!=Acad::eOk){delete pBlockDatabase;return NULL;} AcDbObjectId idInsRecord; es=pBlockTable->getAt(pBlockName,idInsRecord); AcDbObjectIdArray objIds2Copy; objIds2Copy.append(idInsRecord); pBlockTable->close(); if(es!=Acad::eOk){delete pBlockDatabase;return NULL;} AcDbIdMapping idMap; es = pBlockDatabase->wblockCloneObjects(objIds2Copy,acdbSymUtil()->blockModelSpaceId(pWorkDatabase),idMap, AcDb::kDrcReplace); if(es == Acad::eOk) { es = pWorkDatabase->getSymbolTable(pBlockTable2, AcDb::kForRead); es = pBlockTable2->getAt(pBlockName,idImported,AcDb::kForRead); SetBlockDrawOrder(idInsRecord,idImported,idMap); es = pBlockTable2->close(); } }catch(...){delete pBlockDatabase;return NULL;} delete pBlockDatabase; return idImported; } // my code AcDbObjectId importBlockToCurDWGDatabase(const ACHAR *pBlockName /*block name*/, const ACHAR *pFileName /*full path to the file with this block*/) { Acad::ErrorStatus es=Acad::eOk; AcDbObjectId idImported = AcDbObjectId::kNull; // output ID of our block in current database AcDbDatabase* pWorkDatabase = acdbHostApplicationServices()->workingDatabase(); AcAxDocLock docLock(pWorkDatabase); AcDbDatabase* pBlockDatabase = new AcDbDatabase(false,true); es = pBlockDatabase->readDwgFile(pFileName); if(es!=Acad::eOk){delete pBlockDatabase;return NULL;} try { AcDbBlockTable* pBlockTable, *pBlockTable2; es=pBlockDatabase->getSymbolTable(pBlockTable,AcDb::kForRead); if(es!=Acad::eOk){delete pBlockDatabase;return NULL;} AcDbObjectId idInsRecord; es=pBlockTable->getAt(pBlockName,idInsRecord); pBlockTable->close(); if(es!=Acad::eOk){delete pBlockDatabase;return NULL;} AcDbDatabase* pTempDB; es=pBlockDatabase->wblock(pTempDB,idInsRecord); if(es!=Acad::eOk){delete pBlockDatabase;return NULL;} es=pWorkDatabase->insert(idImported,pBlockName,pTempDB); delete pTempDB; if(es!=Acad::eOk){delete pBlockDatabase;return NULL;} }catch(...){delete pBlockDatabase;return NULL;} delete pBlockDatabase; return idImported; }