Story elevation in Python
Hi guys,
please how can I get Story Elevation from the Spatial Locations Manager?
Thank you.
Comments
-
I am a newbie in LISP/Python programming. So is there a possibility to integrate LISP commands into Python script?
Thanks
0 -
Hello.
Bricscad doesn't include a Python API.
The only python functionalities are the ones provided by the BIMPYTHON command.
More details about this can be found in the article linked below.
===
Concerning using lisp, you could experiment using the BIM LISP API.
The link below leads to a web page containing more details about this.===
A very basic example, related to the topic of this post, is like this:
<pre>
(vl-load-bim)
(defun fn_elevations (/ bldgs bldg stories story elev)
(setq bldgs (bim:get-all-buildings))
(foreach bldg bldgs
(princ (strcat "\n" bldg " :"))
(setq stories (bim:get-all-stories bldg))
(foreach story stories
(setq elev (bim:get-story-elevation bldg story))
(princ (strcat "\n" story "\t\t - " (rtos elev 2 2)))
)
(princ "\n\n")
)
(princ)
)
</pre>This will list buildings, floors, and elevations at the command prompt.
0 -
Does Bricsys have a good sample drawing I can use for unit testing
edit… i found one
0 -
Thank you. I need it in a more complex code, so maybe I will try to do it in NET.
0 -
You can use Python, if you can get PyRx to load, https://github.com/CEXT-Dan/PyRx
it’s more of a DIY, I wrapped some of BRX BIM, maybe it's enoughimport traceback from pyrx import Ap, Db, Ge, Bim @Ap.Command() def doit(): try: db = Db.curDb() for building in Bim.BimBuilding.allObjectBuildings(db): for story in building.allObjectStories(): print(f"{building.name()}, {story.name()}, {story.elevation():.2f}") except Exception as err: traceback.print_exception(err)Main Building, Floor 0, 0.00
Main Building, Floor 1, 3250.00
Main Building, Floor 2, 6500.001
