Hi, thanks for your prompt response! Trying to read an existing mesh and get its raw data (vertices and faces) in this case. The first method didn’t work (vscode complains about 4 ‘problems’):
Blockquote
Instance of ‘OBJ’ has no ‘read’ member
Instance of ‘OBJ’ has no ‘vertices’ member
Instance of ‘OBJ’ has no ‘faces’ member
Instance of ‘OBJ’ has no ‘lines’ member
Blockquote
and it gives the following error message in the output:
Blockquote
C:\Users\pnourian\Documents\bunny.obj
Traceback (most recent call last):
File “c:\Users\pnourian\surfdrive\CONFIGRAPHIX_Software_2019\Genesis_Houdini\Houdini_Visualization\20_PythonHoudini_Setup\PY\TopoVoxelization.py”, line 18, in
obj = OBJ(filepath)
File “C:\Users\pnourian\Anaconda3\lib\site-packages\compas\files\obj.py”, line 29, in init
self.reader = OBJReader(filepath)
File “C:\Users\pnourian\Anaconda3\lib\site-packages\compas\files\obj.py”, line 103, in init
self.open()
File “C:\Users\pnourian\Anaconda3\lib\site-packages\compas\files\obj.py”, line 113, in open
with open(self.filepath, ‘r’) as fh:
FileNotFoundError: [Errno 2] No such file or directory: ‘C:\Users\pnourian\Documents\bunny.obj’
Blockquote
the first set of errors is related to your COMPAS version. my suggestion was based on the latest version (0.15.5) which includes some small changes to the readers…
i would just update COMPAS, but if you prefer using the version you have, the code would be something like this:
I don’t need to use this version; I wanted the most recent version; have reinstalled everything a couple of days ago. I am surprised to see that my compas is a retro version! I just did “conda update compas” in my terminal and strangely i get the same version:
import os
import numpy as np
import scipy as sp
import compas as compas
import pandas as pd
folderPath=os.getcwd()
# print(folderPath)
print(compas.__version__)
filepath=r'C:\Users\pnourian\Documents\bunny.obj'
not sure what the file path error is about. are you sure the file is available in that location?
anyway, i also noticed that the anaconda errors seem to come from your base environment.
i would recommend not using the base environment for anything you do with conda.
think of the base environment as your conda system environment from where you create new environments, update existing ones, or revert to older versions if necessary.
therefore, even if you don’t plan on working on multiple projects in the foreseeable future, it still makes sense to sandbox your work and explorations in a separate environment.
to reset the base do
conda install --revision 1
to create a new environment with COMPAS installed do
conda create -n xxx python=3.7 COMPAS=0.15.5
replace xxx with the name you intend to use.
and don’t forget to activate the environment before you use it…
Thanks for the additional tips about anaconda!
BTW, did it have to be in uppercase letters? I finally managed to get conda to install this version by running this:
conda create -n arch python=3.7 COMPAS=0.15.5 -c conda-forge
But, now, I am wondering how to navigate to this environment in vscode (I can only choose my python interpreter); becuase I still see the same version (0.11) in my vscode…
Managed to navigate to the new environment in vscode when choosing my python interpreter; but again I see that conda version is 0.11 (when I print ). I am getting a feeling that this problem is not related to compas so I apologize for taking your precious time with this; but do you think I am missing something in vscode; or would you recommend uninstalling and installing COMPAS again using these two:
conda uninstall -arch compas
conda install -arch python=3.7 -c conda-forge compas=0.15.5
ps. after uninstalling, I figured out it was still reading compas from the base environment, in spite of having chosen the python interpreter from the specific environment.