Skip to content
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

To get the coordinate of the intersection point of a grid by clicking the point #54

Open
son00007 opened this issue Mar 7, 2024 · 1 comment

Comments

@son00007
Copy link

son00007 commented Mar 7, 2024

When I run this python code for the captioned, the error occured as follows, File "c:\Users\sonsun\AppData\Local\Programs\Python\Python311\Lib\site-packages\comtypes\automation.py", line 843, in _invoke
self.__com_Invoke(memid, riid_null, lcid, invkind, dp, var, None, argerr)
_ctypes.COMError: (-2147352567, '예외가 발생했습니다.', ('Invalid argument Point in GetPoint', 'AutoCAD', 'C:\Program Files\Autodesk\AutoCAD 2019\HELP\OLE_ERR.CHM', -2145320939, None))
for the following code,
from pyautocad import Autocad, APoint
acad = Autocad(create_if_not_exists=True)
doc = acad.ActiveDocument
def gpuser():
sp = APoint(0, 0, 0) # Initializing sp with coordinates (0, 0, 0)
ep = APoint(0, 0, 0) # Initializing ep with coordinates (0, 0, 0)
rp = APoint(0, 0, 0) # Initializing rp with coordinates (0, 0, 0)
sp = doc.Utility.GetPoint("\nBottom-left corner on the column:")
ep = doc.Utility.GetPoint("\nBottom-right corner on the column:")
rp = doc.Utility.GetPoint("\nTop-left corner on the row:")
print("sp(1) input =", sp[0]) # Assuming you want to print the X coordinate of the 'sp' point
gpuser()
How can I fix the error and to get the correct response from the active autocad drawing.
Thanks in advance,
Sun, Son

@CEXT-Dan
Copy link

CEXT-Dan commented Mar 7, 2024

ActiveX get point can accept a base point.
Play around with

GetPoint(None, Prompt) or
GetPoint(pythoncom.Empty, Prompt) or

From my wrappers
https://github.com/CEXT-Dan/PyRx/blob/fb2f51acf279239869f7d24d1040647f996e8ca5/PyRxStubs/AxApp24.py#L24705-L24715

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants