ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set System Variables section via RealDWG?

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
alanchen123
867 Views, 6 Replies

How to set System Variables section via RealDWG?

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!

6 REPLIES 6
Message 2 of 7
artc2
in reply to: alanchen123

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.

Message 3 of 7
m_latz
in reply to: alanchen123

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

Message 4 of 7
artc2
in reply to: m_latz

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.

Message 5 of 7
m_latz
in reply to: artc2

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 🙂

Message 6 of 7
Alexander.Rivilis
in reply to: artc2

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
Expert Elite Member

Message 7 of 7
artc2
in reply to: Alexander.Rivilis

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).

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost