VictorC Posted March 8, 2024 Posted March 8, 2024 Hello everyone, I hope I can get some help on this the following. I have a TIN surface that was created from topography points. I have multiple trees which are placed on different parts of the x-y plane of the TIN surface (z-plane is elevation). I need the base of the trees to align to the z-axis of the TIN surface at the location the tree is. Currently the trees are at the same z-axis coordinate. Is there a command in AutoCAD that lets me select the trees and snap them to the TIN surface? Attached is an example of the main file I'm dealing with. TIN surface is in LG_TOPO and trees are in LG_TREES. Thank you very much for the help! example.dwg Quote
BIGAL Posted March 10, 2024 Posted March 10, 2024 So all trees are at say z=0 is that what your saying ? Ok good news and bad news if you have CIV3D there is a built in option to get a XYZ point on a TIN. Ok there is a formula for a 3D point given XY on a 3dface. Ie 3 point plane. There is some free TIN software out there but I don't know if it does a point. You may need to copy the tin and explode it then can get a point on a 3DFACE. But have to Google for the code. Just a question did you add the trees so they were not field surveyed. Quote
CyberAngel Posted March 11, 2024 Posted March 11, 2024 See this page. If you can load a TIN surface, you should have access to Civil 3D commands. On the Surface menu, pull down the Utilities. There's a command to Move Blocks to Surface. If you're using some other flavor of AutoCAD, take BigAl's advice and find some code to do the same thing. Quote
BIGAL Posted March 11, 2024 Posted March 11, 2024 If you used Google you may find this, Have a look at the GP code but note needs 3dfaces not a TIN. Quote
Danielm103 Posted March 12, 2024 Posted March 12, 2024 If there’s not command, you can do this with the API. Here’s a sample in Python. check the drawing and make sure it's correct : ) import traceback from pyrx_imp import Rx from pyrx_imp import Ge from pyrx_imp import Gi from pyrx_imp import Gs from pyrx_imp import Db from pyrx_imp import Ap from pyrx_imp import Ed from pyrx_imp import Cv # debug def PyRxCmd_pydebug() -> None: import PyRxDebug PyRxDebug.startListener() def PyRxCmd_doit() -> None: try: db = Db.curDb() esel = Ed.Editor.entSel("\nSelect TIN Surface: ", Cv.CvDbTinSurface.desc()) if esel[0] != Ed.PromptStatus.eOk: print("Oops {}: ".format(esel[0])) return filter = [(0, "INSERT"), (2, "Simple Tree")] ssres = Ed.Editor.selectAll(filter) if ssres[0] != Ed.PromptStatus.eOk: print("Oops {}: ".format(ssres[0])) return pSurface = Cv.CvDbTinSurface(esel[1]) for id in ssres[1].objectIds(): ref = Db.BlockReference(id, Db.OpenMode.kForWrite) sp = ref.position() ep = sp + Ge.Vector3d.kZAxis * pSurface.maxElevation() line = Db.Line(sp,ep) pnts = pSurface.intersectWith(line,Db.Intersect.kExtendArg) if len(pnts): ref.setPosition(pnts[0]) except Exception as err: traceback.print_exception(err) example.dwg Quote
Danielm103 Posted March 14, 2024 Posted March 14, 2024 FYI, someone posted a solution for lisp at the bricscad forum https://forum.bricsys.com/discussion/38746/reposition-block-refs-onto-a-tin-with-python#latest Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.