About a year ago I wrote a python script that would grab objects from an existing stream/commit, my objective was to grab elements from a Revit model draw them into ETABS one by one.
Anyway, I’m revisiting my code now and I’m finding its no longer working, the problem is this line of code below.
The commit is always None:
Previously, I was able to use operations.receive from commit but now it no longer seems to work, this is the code that used to follow:
Has something changed in the past year or so that makes this no longer work?
It is possibly a bit challenging to give a comprehensive answer based on a few lines of code, so appologies if the follow-up questions seem a bit straightforward:
There are no errors or warning messages, just an empty return?
Assuming client has been authenticated (authenticate_with_token)?
Has the stream_id or commit_id changed?
@Nikos has done some cool work in grabbing information from Revit recently, so any changes (of which I’m not aware) would be included in this code:
from specklepy.transports.server import ServerTransport
from specklepy.api import operations
from specklepy.api.client import SpeckleClient
client = SpeckleClient(host="https://latest.speckle.systems") # OR https://app.speckle.systems/
client.authenticate_with_token("SPECKLE_TOKEN") # Prviate token
new_stream_id = "STREAM_ID"
obj_id = "OBJ_ID"
transport = ServerTransport(client=client, stream_id=new_stream_id)
new_stream = client.stream.get(id=new_stream_id)
received_base = operations.receive(obj_id=obj_id, remote_transport=transport)
print(received_base)
This will receive your model as a collection.
Does this help? If not, please do share more of the code (removing any tokens / model ids etc.) with me so I can have a better look.
I think I found the problem, which ended up being rather obvious!
Initially, I was copying the stream and commit ID from the URL on the new web app. I understand these were renamed to ‘projects’ and ‘models’ some time ago. What I noticed, is that the commit ID on the new and old web apps are different. I tried my old code with the ID from the old web app and it worked.
Is this deliberate or is it something that should be fixed? Looks like it might cause confusion, especially for those with existing code.
Ah yeah, apologies for not explaining that. Every object has an id, even the model itself has an id. If you open up a model, navigate to Scene Explorer on the left-hand side and activate dev mode, the model id will be at the upper most hierarchical level:
You are correct, we are a little bit in limbo regarding naming. In the web app we have renamed the structure to projects → models → versions, however, specklepy should still be referencing the old naming without any problems
Maybe important to note here, the “new web app” (under latest.speckle.systems) is our development server and is flagged as “transient” because we keep the server at the cutting edge of our development branch.
What do you mean by default: through the connectors or through the speckle.systems website? On the connectors side, you can select a default account through the Manager: