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

Create region in AutoCAD using pyautocad (Python)

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
tanmayms3009
1208 Views, 4 Replies

Create region in AutoCAD using pyautocad (Python)

Hi, 

 

According to the documentation for the "AddRegion" method provided on AutoCAD2022 Developer and ObjectARX Help: "https://help.autodesk.com/view/OARX/2022/ENU/?guid=GUID-74C8765E-EB4A-4773-ADD4-6C0F318FE6BE"

we need to pass the safearray of objects to Block or Modelspace to create a region.

 

Since I have been working on documenting the use of pyautocad as a means to automate AutoCAD tasks, I want to perform the same operation using python. But none of the python-based data structures (e.g. List, Tuples, Sets etc.) worked for adding a region. Also, I tried creating a customized array using "win32com" module, still no satisfactory output. Can anyone please guide me through this?

 

Thanks in advance.

Labels (1)
4 REPLIES 4
Message 2 of 5

Try this code: https://adn-cis.org/forum/index.php?topic=7864.msg45040#msg45040

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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 3 of 5

Many thanks for the response, Sir.

 

Can you please also tell me how to get a Region object in return? Because the AddRegion does not return a Region object but an Array of Variants. 

 

Thanks in advance!

Message 4 of 5

изображение.png

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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 5 of 5

Yes correct. Thanks for your help once again.

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report