Hi,
I am trying creating a dwg file with the C++ RealDWG libraries. But I do not know how to set the variables in System Variables section named ucsorg, ucsxdir, ucsydir, as I can get their values with AcDbDatabase.ucsorg(), AcDbDatabase.ucsxdir(), and AcDbDatabase.ucsydir(), but cannot set them.
Can you help me? Thanks!
Solved! Go to Solution.
Solved by artc2. Go to Solution.
Unfortunately, there currently are no APIs to set those in RealDWG. The only thing that I can think of, and it is messy, is that you could save to dxf, open the resulting text file, change the necessary values, save that, and then read that into a new empty database.
These three variables represet the current ucs coordinate system.
To modify create a new UCS (AcDbUCSTableRecord) and use the returned AcDbObjectId for AcDbDatabase->setUcsBase(AcDbObjectId ucsid).
If you then read again the values from AcDbDatabase->ucsorg(), ->ucsxdir() and ->ucsydir(), they should have the values from the new ucs.
regards
Markus
Did you test this with RealDWG? I ask because internally setUcsBase() just sets the objectId into a data member which is not used by ucsorg(), ucsxdir,() or ucsydir() - they all directly access other data members which are not changed by setUcsBase(). In an AutoCAD environment (as opposed to RealDWG), it's possible that setUcsBase() might (I haven't tried it) change ucsorg(), ucsxdir(), and ucsydir() because AutoCAD could act as an intermediary and change the ucsorg, ucsxdir, and ucsydir data members when setUcsBase() is run.
Not tested just theory. I will try tomorrow with a little test program. But because you have a closer look to RealDWG I suspect you're right.
On the other hand there is always a solution in RealDWG 🙂
Hi, Art!
Do I understand correctly that if the dwg-file is opened using AcDbDatabase::readDwgFile and not open as a document in AutoCAD, it is impossible to set UCS to WCS? That is not ACDB API to set ucsorg, ucsxdir, ucsydir for AcDbDatabase? Maybe undocumented API ? 😉
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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
Yes, that's what I'm saying - at least for the currently shipping releases. And, I'm not aware of any undocumented API for this. Apparently this hasn't been something anyone cared about (at least not vocally) until relatively recently (I only learned of the limitation last year).