Closed ambrogomez closed 4 years ago
Hi,
Did you reference the correct dll and import its namespace first? (Autodesk.Navisworks.Clash.dll)
Hi there,
Hmmm being honest I am not totally sure. I think I referenced the correct dll although.
In term of importing. I have not imported it. May I ask how to import it? Although if I have access to copyclash, testData, test, and others... it made me think it was imported.
Let me know your advice please.
Thanks
Hi,
Did you regerence the correct dll and import its namespace first? (Autodesk.Navisworks.Clash.dll)
Hi there,
Thank you for the previous answer.
I am just trying to import the namespace but I am not having any luck. Try in different ways, as it may be the case I am not writing correctly... Examples tried:
>>> from Autodesk.Navisworks.Api.Clash import * Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named Clash
>>> from Autodesk.Navisworks.Clash import * Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named Clash
I have seen the assembly: Assembly: Autodesk.Navisworks.Clash (in Autodesk.Navisworks.Clash.dll) was not in the Assemblies folder when I download from the website. Is it the issue?
Thank you very much. I am not good compiling... if you have any website/tutorial or any location where I can read and learn further it will be great.
Thanks again.
Solution below:
import clr
import sys
sys.path.append(r'C:\Program Files\Autodesk\Navisworks Manage 2018\Autodesk.Navisworks')
clr.AddReference('Autodesk.Navisworks.Timeliner.dll') clr.AddReference('Autodesk.Navisworks.Clash.dll')
from Autodesk.Navisworks.Api.Clash import from Autodesk.Navisworks.Api.Timeliner import
Thanks
Glad you figured it out!
You can make it a bit more version agnostic like so:
navisDir = doc.GetType().Assembly.Location.rsplit("\\", 1)[0]
import sys
sys.path.append(navisDir)
import clr
clr.AddReference("Autodesk.Navisworks.Clash")
from Autodesk.Navisworks.Api.Clash import ClashTest
#test the creation
ct = ClashTest()
print ct
Thank you mate.
Appreciate it :)
On Tue, 17 Sep 2019, 08:39 Dimitar Venkov, notifications@github.com wrote:
Glad you figured it out!
You can make it a bit more version agnostic like so:
navisDir = doc.GetType().Assembly.Location.rsplit("\", 1)[0]
import sys sys.path.append(navisDir)
import clr clr.AddReference("Autodesk.Navisworks.Clash") from Autodesk.Navisworks.Api.Clash import ClashTest
test the creation
ct = ClashTest() print ct
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/dimven/NavisPythonShell/issues/7?email_source=notifications&email_token=ALR2RPAWCDUWIMRGNDT67FTQKCCS7A5CNFSM4IXB5RK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD63TSXQ#issuecomment-532101470, or mute the thread https://github.com/notifications/unsubscribe-auth/ALR2RPFUQKXYFJYNZ3RNA73QKCCS7ANCNFSM4IXB5RKQ .
Glad you figured it out!
You can make it a bit more version agnostic like so:
navisDir = doc.GetType().Assembly.Location.rsplit("\\", 1)[0] import sys sys.path.append(navisDir) import clr clr.AddReference("Autodesk.Navisworks.Clash") from Autodesk.Navisworks.Api.Clash import ClashTest #test the creation ct = ClashTest() print ct
Hi,
Does this works within the NavisPythonShell plug-in of Navisworks? Or also in Dynamo Sandbox?
Thanks.
Hi there,
ClashTest Constructor Create a clash test. Namespace: Autodesk.Navisworks.Api.Clash Assembly: Autodesk.Navisworks.Clash (in Autodesk.Navisworks.Clash.dll)
I think it should be as simple as:
newclash = ClashTest()
For some reason I cannot figure out it does not work in PythonShell. Any thought or advice?
Thank you very much in advance.
Note: I can do a workaround by duplicating a current ClashTest and do anything from there, but I would prefer if I can use the ClashTest constructor.