HebHeb Posted October 5, 2023 Share Posted October 5, 2023 (edited) Hello there, it would be nice to have a native node that operates with the DTM. Input: Site Model (via Location on Layer - handle Input via obj by criteria ?) State of the site model (existing/proposed) x/y-Value Output: z-Value btw: I am aware of the possibility right now 😉 https://developer.vectorworks.net/index.php/VS:DTM6_GetZatXY I don't come from a scripting background, and never feel comfortable (or future proof for version updates) when I create my own nodes... Cheers! Edited October 5, 2023 by HebHeb Quote Link to comment
HebHeb Posted December 5, 2023 Author Share Posted December 5, 2023 (edited) Hello, I somehow can't figure out how i get the "resulting" object when using "VS:DTM6 SendToSurface" there are some comments on developer.vectorworks.net: Quote Ptr [2020.09.14]:When applying this call on a 2D object, that 2D object gets converted into a 3D polygon. The handle to the 2D object will not be linked to this 3D polygon. "vs.LNewObj()" will not return the handle to the 3D polygon.  vs.LNewObj() doen't seem to give the handle to the desired result... i am really no expert in creating my own nodes, so please be patiend ;D  ...see attched file maybe @Marissa Farrell can sort this out. the "send to surface" operation seems to work, i just can't get the output handle-  @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( 'Send to DTM Surface' ) this.SetDescription( 'sends object to DTM Surface' ) #Input Ports hPath = Marionette.PortIn( vs.Handle(0), 'hPath' ) hPath.SetDescription( 'the input path' ) hLayer = Marionette.PortIn( 0 ) hLayer.SetDescription( 'the layer containing the DTM' ) iTINType = Marionette.PortIn( 0 ) iTINType.SetDescription( 'A number identifying the Site Model surface (0 = existing or 1 = proposed)' ) #OIP Controls #Output Ports hPathOUT = Marionette.PortOut('hPathOUT') hPathOUT.SetDescription( "the resultung elevated path" ) #BEHAVIOR def RunNode(self): #inputs hPath = self.Params.hPath.value hLayer = self.Params.hLayer.value hDTMObject = vs.DTM6_GetDTMObject(hLayer) iTINType = self.Params.iTINType.value #script vs.DTM6_SendToSurface(hDTMObject, hPath, iTINType) ### hPathOUT = ### #outputs ### self.Params.hPathOUT.value = hPathOUT ###  HebHeb_send to DTM Surface.vwx Edited December 5, 2023 by HebHeb Quote Link to comment
Pat Stanford Posted December 5, 2023 Share Posted December 5, 2023 In Vectorscript for cases like this where LNewObject does not return the proper object, we use the "Waldo" method (referring to the famous puzzle book, "Where's Waldo") Â Basically, the method is: Â Do your operation that creates an object. Create a loci and get a handle to the loci. Get the Previous Object handle. Delete the loci. Â Not sure how you would make this work in Marionette. Â 1 Quote Link to comment
HebHeb Posted December 5, 2023 Author Share Posted December 5, 2023 Thanks for your reply. Now the Python example makes sense ;D  _, _sPIOName, _hPIO, _hPIORecord, _hWall = vs.GetCustomObjectInfo() # Get info from current PIO instance _hPath = vs.GetCustomObjectPath(_hPIO) _hDTM = vs.DTM6_GetDTMObject(vs.GetLayer(_hPIO), False) # Get Site Model on the PIO's layer _hPoly2D = vs.HDuplicate(_hPath, 0, 0) _b = vs.DTM6_SendToSurface(_hDTM, _hPoly2D, 0) vs.Locus(0, 0) # Create a dummy object _h = vs.LNewObj() _hPoly3D = vs.PrevObj(_h) vs.DelObject(_h) # Delete the dummy object I kind of failed like shown above, but with waldo in my mind i'll give it another try 😉 But anyhow, I hope someone can sort it out  Quote Link to comment
HebHeb Posted December 6, 2023 Author Share Posted December 6, 2023 FYI. Found a working soloution: In some cases (i.e. when using a rectangle as path) i had to ungroup twice to get the 3D poly handle. Â @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( 'Send to DTM Surface' ) this.SetDescription( 'sends object to DTM Surface' ) #Input Ports hPath = Marionette.PortIn( vs.Handle(0), 'hPath' ) hPath.SetDescription( 'the input path' ) hLayer = Marionette.PortIn( 0 ) hLayer.SetDescription( 'the layer containing the DTM' ) iTINType = Marionette.PortIn( 0 ) iTINType.SetDescription( 'A number identifying the Site Model surface (0 = existing or 1 = proposed)' ) #OIP Controls #Output Ports hPathOUT = Marionette.PortOut('hPathOUT') hPathOUT.SetDescription( "the resultung elevated path" ) #BEHAVIOR def RunNode(self): #inputs hPath = self.Params.hPath.value hLayer = self.Params.hLayer.value hDTMObject = vs.DTM6_GetDTMObject(hLayer) iTINType = self.Params.iTINType.value #script vs.DTM6_SendToSurface(hDTMObject, hPath, iTINType) vs.Locus(0, 0) # Create a dummy object dummy = vs.LNewObj() hPathOUT = vs.PrevObj(dummy) vs.DelObject(dummy) # Delete the dummy object #outputs self.Params.hPathOUT.value = hPathOUT Â Quote Link to comment
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.