TBC Macros and Extensions

 View Only
Expand all | Collapse all

V5.40 changed the way to access points from pointclouds - any idea how that works now?

  • 1.  V5.40 changed the way to access points from pointclouds - any idea how that works now?

    Posted 01-14-2021 20:05

    Unfortunately part of an old macro stopped working with the upgrade to V5.40.
    Before, the selected part of a point cloud was a "PointCloudRegion"-object and it had a function "CollectSelectedPoints"
    Now, in V5.40, it's an "ExposedPointCloudRegion"-object, and that has pretty much no functions at all. How can I get the selected points into a Point3DArray now?

    It's a bit annoying if they change those things. It took me hours to find the previous code and now I have to spend time again, sifting through the object browser.

    Especially for newbies it would be highly appreciated if Trimble would compile/provide code snippets for some main task. Working with layers, adding, deleting objects, computing with polysegs, computing/adding/removing from surfaces, accessing point cloud data etc. etc.. I have no idea what i.e. those Interface Snapins are. After all, the macro language is advertised as being part of TBC, but it's rather crappy documented and lacking example code.

    working code, prior to V5.40:
    self.pointcloudType = clr.GetClrType(PointCloudRegion)

    pointlist=Point3DArray()
    pointcloudlist = List[PointCloudRegion]([])
    selectedcloudpoints=List[Point3D]([])

    for o in self.objs.SelectedMembers(self.currentProject):
           if isinstance(o, self.pointcloudType):
             pointcloudlist.Add(o)

    if pointcloudlist.Count>0:
         PointCloudRegion.CollectSelectedPoints(pointcloudlist, selectedcloudpoints, None)
          if selectedcloudpoints.Count>0:
              for i in range(0,selectedcloudpoints.Count):
                   pointlist.Add(selectedcloudpoints[i])



    ------------------------------
    Ronny Schneider
    ------------------------------


  • 2.  RE: V5.40 changed the way to access points from pointclouds - any idea how that works now?

    Posted 03-05-2021 11:00
    Did you ever get an answer to this or figure it out yourself?

    I can't remember if @Gary Lantaff ever created a sample TML with point clouds.  If so, perhaps he can post some updated code.

    I heartily agree that sample code (that's updated and working) is a great resource for both new and experienced developers.

    And yes, it would be nice if the dev team could communicate API changes - even after a release - rather than us figuring it out randomly when a TML breaks when you try to use it.  This puts a lot of burden on TML developers to manually test all their TMLs whenever a release comes out.

    ------------------------------
    Quan Mueller
    Revenant Solutions - TML Development
    ------------------------------



  • 3.  RE: V5.40 changed the way to access points from pointclouds - any idea how that works now?

    Posted 03-08-2021 00:04
    Hello Quan,
    no, haven't got an answer but also didn't look into it myself anymore. Initially that was more a proof of concept to work with any type of points. The main purpose of that macro was and still is to auto-connect a bunch of points by setting a seed point and then always jump to the next closest one. Quickly create a breakline along line end points, created with the "Create from CAD" function.

    But I'll look into the point cloud points at some stage again. I have to double check, but I believe we still haven't got a best fit arc from point cloud points in TBC. So I might have to look into programming it myself. Initially I missed that functionality in 2018, to get the center of a scanned pipe for instance. I believe you'd still have to resort to Realworks for that.

    ------------------------------
    Ronny Schneider
    ------------------------------



  • 4.  RE: V5.40 changed the way to access points from pointclouds - any idea how that works now?

    Posted 03-08-2021 18:07

    That's a cool TML (AutoConnectPoints).  If you have a lot of points to "connect", that's a huge time/click saver.

    Best fit arc from point cloud pts sounds interesting too.

    You might try posting the idea on the TBC forums and seeing if others want it and if the TBC dev team is interested in it.  The geospatial side of TBC certainly loves their point clouds.  And something that dovetails with Realworks might be attractive too.

    Course, the great part about TMLs is that you don't have to wait for all of that - but if you're not in a rush and they want to build it, could save you from coding it yourself.



    ------------------------------
    Quan Mueller
    - TML Development
    ------------------------------



  • 5.  RE: V5.40 changed the way to access points from pointclouds - any idea how that works now?

    Posted 02-03-2023 12:57
    This is very cool Ronny

    ------------------------------
    Patrick L'heureux
    ------------------------------



  • 6.  RE: V5.40 changed the way to access points from pointclouds - any idea how that works now?

    Posted 02-02-2023 14:40
    I didn't tinker with that for a while, but yesterday I had another look and finally found the answer.
            self.pointcloudType = clr.GetClrType(PointCloudRegion)
    
    
                        elif isinstance(o, self.pointcloudType):
                            integration = o.Integration  # = SdePointCloudRegionIntegration
                            selectedid = integration.GetSelectedCloudId() # it seems the selected points form a sub-cloud
    
                            regiondb = integration.PointCloudDatabase # PointCloudDatabase
                            sdedb = regiondb.Integration # SdePointCloudDatabaseIntegration
                            scanpointlist = sdedb.GetPoints(selectedid)


    ------------------------------
    Ronny Schneider
    ------------------------------