Hi,
I’d like to use methods belonging to sample line groups and sample lines in python, but I don’t know how can I reference my existing sample line groups and sample lines. Can someone help me out with an example?
What have you tried so far? Please share your work.
Not much. I tried to refer the generated samle line group, by querying it’s ID with “Alignment. GetSampleLineGroupIds” method, but with the ID I couldn’t use the methods of SampleLineGroup Class. I think I need to refer that object another way.
This script only generates the group and the samle lines.
sample_line_test.dyn (7.3 KB)
You can use dynamo SL or SLG nodes as input, then you can access the InternalObjectId and you have to open the object using that id.
Code examples:
Sample line group input:
Get group using sample line:
Yes, thanks for the tip, but I want to reach the new objects during the same script running. So I want to refer somehow the newly generateg sample line group in the python editor. Is it possible?
When you create the SLG the Create () Method should return the SLG ObjectId, so you should be able to use that.
https://help.autodesk.com/view/CIV3D/2025/ENU/?guid=9af1af05-2e6a-9970-376a-6d80ed83c868
Thanks a lot, it works now.