-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Drawing Dimensions.Add Error #229
Comments
Equivalent CATIA VBA Code
|
I have Solved the Issue Myself, Just Passed Com _Object
|
I'm re-opening this issue as you shouldn't have to do that as an end user. That should be done within the class method itself so I'll get this patched soon. However, the update will break your current solution. |
There's been some ninja editing here ... The original question was regarding the |
I've submitted fixes for both Here are complete working examples for both. These require an already open CATDrawing with an active view. DrawingDimensions.add()from pycatia import catia
from pycatia.enumeration.enumeration_types import cat_dim_type
from pycatia.enumeration.enumeration_types import cat_dim_line_rep
from pycatia.drafting_interfaces.drawing_document import DrawingDocument
caa = catia()
drawing_document: DrawingDocument = caa.active_document
sheets = drawing_document.sheets
sheet = sheets.active_sheet
views = sheet.views
active_view = views.active_view
factory_2d = active_view.factory_2d
line_1 = factory_2d.create_line(50, 10, 150, 10)
line_2 = factory_2d.create_line(50, 10, 120, 100)
elipse = factory_2d.create_ellipse(-40, 100, 120, 180, 120, 90, 0, 3)
point_1 = factory_2d.create_point(-10, 190)
point_2 = factory_2d.create_point(-120, 190)
catDimAngle = cat_dim_type.index('catDimAngle')
catDimAuto = cat_dim_line_rep.index('catDimAuto')
line_elements = (line_1, line_2)
selection_points_1 = (150, 10, 120, 100)
active_view.dimensions.add(catDimAngle, line_elements, selection_points_1, catDimAuto)
catDimLengthCurvilinear = cat_dim_type.index('catDimLengthCurvilinear')
catDimOffset = cat_dim_line_rep.index('catDimOffset')
var_elements = (point_1, point_2, elipse)
selection_points_2 = (0, 0, 0, 0)
active_view.dimensions.add(catDimLengthCurvilinear, var_elements, selection_points_2, catDimOffset) DrawingDimensions.add2()from pycatia import catia
from pycatia.enumeration.enumeration_types import cat_dim_type
from pycatia.enumeration.enumeration_types import cat_dim_line_rep
from pycatia.drafting_interfaces.drawing_document import DrawingDocument
caa = catia()
drawing_document: DrawingDocument = caa.active_document
sheets = drawing_document.sheets
sheet = sheets.active_sheet
views = sheet.views
active_view = views.active_view
factory_2d = active_view.factory_2d
point_1 = factory_2d.create_point(40, 230)
point_2 = factory_2d.create_point(80, 210)
line_1 = factory_2d.create_line(50, 10, 150, 10)
catDimDistance = cat_dim_type.index('catDimDistance')
point_elements = (point_1, point_2)
selection_points = (0, 0, 0, 0)
dimension = active_view.dimensions.add2(catDimDistance, point_elements, selection_points, line_1, 0) |
Thank you so much for the support @evereux |
This has now been released. |
Describe the bug
I have created two points in the Drawing, then tried to generate the Dimensions for it, Just I need to show the Distance Between the Points.
Error:
'''
Traceback (most recent call last):
File "d:\Tesing\Drwing\todrw.py", line 86, in
my_dimension = drawing_view.dimensions.add(catDimDistance, elements, selpoints, catDimDistanceMin)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\pycatia\drafting_interfaces\drawing_dimensions.py", line 113, in add
self.drawing_dimensions.Add(
File "<COMObject >", line 2, in Add
TypeError: must be real number, not Point2D
'''
Code
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: