-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
plugin problem #497
Comments
Hello. First, I haven't fully grasped your situation, so please provide the following information:
Additionally, if you can provide the results in a code block format as shown here: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#fenced-code-blocks, it would be greatly appreciated. |
Thank you for your reply, Pyaxis is a Python package for AxisVM. you can find more here (https://github.com/AxisVM/pyaxisvm). I'm using Python 3.11.4 on my laptop and 3.12.0 on my PC. I will write the code here then point out the code blocks that don't work on my pc. import axisvm
import comtypes
import comtypes.client as cc
import sys
from time import sleep # Define AX_APP_PROGID for the AxisVM application
AX_APP_PROGID = 'AxisVM.AxisVMApplication'
#Define AX_APP_PROGID for the AxisVM application
AX_APP_PROGID = 'AxisVM.AxisVMApplication'
# Import the 'ax' module for AxisVM
try:
import comtypes.gen._0AA46C32_04EF_46E3_B0E4_D2DA28D0AB08_0_17_200 as ax
print("AxisVM module imported!")
except:
print("AxisVM module import error !")
# Define the StartAxisVM() function as in the first code snippet
def StartAxisVM():
axApp = None
try:
axApp = cc.CreateObject(AX_APP_PROGID, comtypes.CLSCTX_ALL, None, ax.IAxisVMApplication)
print("AxisVM object created")
except:
print("error creating the object!")
sys.exit()
if not axApp is None:
if WaitForAxisVM_loaded(axApp):
axApp.Visible = ax.lbTrue
axApp.CloseOnLastReleased = ax.lbFalse
axApp.AskCloseOnLastReleased = ax.lbTrue
axApp.AskSaveOnLastReleased = ax.lbTrue
axApp.ApplicationClose = ax.acEnableNoWarning
return axApp
if axApp is None:
print("AxisVM start error !")
exit()
# Define the WaitForAxisVM_loaded() function as in the first code snippet
def WaitForAxisVM_loaded(aAxApp):
try:
while not (aAxApp.Loaded == ax.lbTrue):
sleep(0.1)
print("waiting")
return True
except:
return False
# Rest of the code for loading the model from file
model_file_path = "C:/Users/user/Downloads/OLD BRIDGE - TENDONS INSIDE CONCRETE - successfull analysis.axe"
try:
axApp = StartAxisVM()
axModel = axApp.Models[1]
axModel.LoadFromFile(model_file_path)
print(f"Model '{model_file_path}' loaded successfully.")
except Exception as e:
print(f"Error loading model: {str(e)}") # Define the AxisVM model
axm = axModel
#Load Case 1 - Constant distributed vertical load on the whole domain
lcid1 = 1
axm.LoadCases.Name[1] = 'LC1' the next code block only works on my laptop and on my PC gives an error. qz = -1.0 # load intensity
LoadDomainConstant = axtlb.RLoadDomainConstant(
LoadCaseId=lcid1,
DomainId=121,
qx=0,
qy=0,
qz=qz,
DistributionType=axtlb.sddtSurface,
SystemGLR=axtlb.sysGlobal
)
_ = axm.Loads.AddDomainConstant(LoadDomainConstant) The result of the code is to open a file (model on AxisVM) and define a load case. |
Thank you for the information. Please try the following:
|
thank you for your recommendations,
I tried to degrade Python to 3.11.5 it didn't work, I realized that I had Python downloaded by itself and inside Anaconda, I uninstalled the Python version which is outside anaconda. also, comtypes 1.2 is noncompatible with axisvm package. I got this error (ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
axisvm 1.0.5 requires comtypes==1.1.11, but you have comtypes 1.2.0 which is incompatible.)
…________________________________
From: Jun Komoda ***@***.***>
Sent: Tuesday, October 17, 2023 5:01 AM
To: enthought/comtypes ***@***.***>
Cc: Za'al Ode Al-Hijazeen Asseel ***@***.***>; Author ***@***.***>
Subject: Re: [enthought/comtypes] plugin problem (Issue #497)
Thank you for the information. Please try the following:
1. Since the Python version differs between your laptop and PC, try running it on your PC with Python 3.11.4.
(comtypes hasn't been tested on Python 3.12 in CI yet. We are waiting for the support for Python 3.12 to be added on Appveyor<appveyor/ci#3879>.)
2. comtypes generates Python modules based on the COM library contents in the execution environment. Check the contents of comtypes.gen._0AA46C32_04EF_46E3_B0E4_D2DA28D0AB08_0_17_200.
3. I checked requirements.txt in pyaxisvm, and it's locked to comtypes==1.1.11<https://github.com/AxisVM/pyaxisvm/blob/37dd19272bb6ec63a64e6948001570167b86abd8/requirements.txt#L8>. Try it with the latest version, 1.2.0.
—
Reply to this email directly, view it on GitHub<#497 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BDCWSVGYC32ABQLHIQUADEDX7ZXRLAVCNFSM6AAAAAA6DPVDUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRWGI3TIMBVGI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Did you find any differences in the codebase of Are there any differences in the contents of |
AppVeyor updated their images with Python 3.12 (appveyor/ci#3879). |
@Asseelhij |
@junkmd I am using Python 3.11.5 and comtypes 1.1.11 and it works perfectly. |
I suspect that the generated module under Since |
Hello,
I am trying the Pyaxis connection. I wrote a code that runs successfully on my laptop, but it has some issues when I try to run it on my PC (I need it to work on my PC because my AxisVM model is too heavy to run on my laptop).
So, on my PC, some code snippets work fine. For example, I could open Axisvm via Python and create a new load case, but some code snippets like (patchlines = axm.ObjectCreator.NewLines3d()) give an attribute error:
(KeyError Traceback (most recent call last)
File ~\anaconda3\Lib\site-packages\comtypes_init_.py:274, in _cominterface_meta.new..CaseInsensitive.getattr(self, name)
273 try:
--> 274 fixed_name = self.map_case[name.lower()]
275 except KeyError:
KeyError: 'objectcreator'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
Cell In[22], line 2
1 # origo is located at the left bottom corner
----> 2 patchlines = axm.ObjectCreator.NewLines3d()
File ~\anaconda3\Lib\site-packages\comtypes_init_.py:276, in _cominterface_meta.new..CaseInsensitive.getattr(self, name)
274 fixed_name = self.map_case[name.lower()]
275 except KeyError:
--> 276 raise AttributeError(name)
277 if fixed_name != name: # prevent unbounded recursion
278 return getattr(self, fixed_name)
AttributeError: ObjectCreator)
Can you help me fix this? I tried to uninstall axisvm and comtypes modules and reinstall them, but it was still not working.
thank you in advance.
The text was updated successfully, but these errors were encountered: