Hi to all,
I'd like to have a block that when The user rotate the block I can call automatically a custom function and print of how much degrees is rotated. Could you give me some examples or idea ?
Best Regards,
Marco
Solved! Go to Solution.
Solved by Alexander.Rivilis. Go to Solution.
Solved by Alexander.Rivilis. Go to Solution.
@Anonymous wrote:
could you show me an online sample of if statement using acedGetCommandForDocument ?
Than you,
Marco
What about to read ObjectARX Documents?
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Thank you @Alexander.Rivilis , I appreciated very much your help. Sorry I'm not an Autocad developer, I'm Studing for my thesis ObjectArx. I didn't know that this guide was in the autocad folder.
You have been very kind and I thank you for helping me.
Marco
@Anonymous wrote:
Thank you @Alexander.Rivilis , I appreciated very much your help. Sorry I'm not an Autocad developer, I'm Studing for my thesis ObjectArx. I didn't know that this guide was in the autocad folder.
You have been very kind and I thank you for helping me.
Marco
This guide is a part of ObjectARX SDK (docs folder):
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Hi @Alexander.Rivilis ,
I've downloaded your code but the transformBy() function is not called anytime by AutoCAD. I tried a breakpoint on the function but the code execution never stop on this bp. I think that the code has no effect on my AutoCAD.
I'm attaching my code if you can help me.
P.S. thank you to @moogalm for the .bat script
Best Regards,
Marco
@Anonymous
Test attached code and see this video.
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Hi @Alexander.Rivilis now it's working, thank you.
I'm trying to set an Xdata with the theta calculated by the matrix as you mentioned before.
static void setLayoutAttribute(AcDbEntity* pSubject,double theta) // brefCar must be open for write
{
AcDbObjectId objId = pSubject->objectId();
AcDbObjectPointer<AcDbBlockReference> brefWheel(objId, AcDb::kForWrite);
if (brefWheel.openStatus() == Acad::eOk)
{
LPCWSTR myAppName = L"LAYOUT";
acdbRegApp(myAppName); // Make sure your XData appname is registered
resbuf *rb = acutBuildList(
AcDb::kDxfRegAppName, myAppName,
AcDb::kDxfXdReal, theta,
0
);
brefWheel->setXData(rb);
acutRelRb(rb); // release the list.
}
}
But calling this function from transorfmBy() the blockreference is nevere in openStatus() == eOk.
ACDBCORE2D_PORT virtual Acad::ErrorStatus transformBy(AcDbEntity* pSubject, const AcGeMatrix3d& xform)
{
AcString pGlobalCmdName;
acedGetCommandForDocument(curDoc(), pGlobalCmdName);
acutPrintf(L"\nTransformBy Command name: %s", pGlobalCmdName.kTCharPtr());
if (pGlobalCmdName.compareNoCase(L"ROTATE") == 0) {
double theta;
AcGeVector3d vectors;
getAngleAndAxis(theta, vectors,xform);
acutPrintf(L"Rotazione di : %f radianti", theta);
setLayoutAttribute(pSubject, theta);
}
I'm missing something ?
B.R.
Marco
pSubject is opened before calling setLayoutAttribute(...) So you not need to open it again:
static void setLayoutAttribute(AcDbEntity* pSubject, double theta)
{
bool wasWriteEnabled = pSubject->isWriteEnabled();
if (wasWriteEnabled || pSubject->upgradeOpen() == Acad::eOk)
{
LPCWSTR myAppName = L"LAYOUT";
acdbRegApp(myAppName); // Make sure your XData appname is registered
resbuf* rb = acutBuildList(
AcDb::kDxfRegAppName, myAppName,
AcDb::kDxfXdReal, theta,
0
);
pSubject->setXData(rb);
acutRelRb(rb); // release the list.
if (!wasWriteEnabled) pSubject->downgradeOpen();
}
}
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Can't find what you're looking for? Ask the community or share your knowledge.