TBC Macros and Extensions

 View Only
Expand all | Collapse all

Assistance with Point Cloud Edge Detection and Clicking in TBC Macro Development

  • 1.  Assistance with Point Cloud Edge Detection and Clicking in TBC Macro Development

    Posted 10-24-2024 23:18
    Edited by nayef gmail.com 10-24-2024 23:21

    Hello,

    I'm working on a Trimble Business Center (TBC) macro that performs tasks similar to the Buildings plugin, specifically for handling point cloud data from a scanner. My goal is to streamline edge detection by allowing users to click on a point within the point cloud, initiating automatic edge drawing. Here are a few questions I have:

    1. Click Detection: Can a user click be detected on a specific point within the point cloud? If so, how can I retrieve the coordinates or identifier of the clicked point?

    2. Automating Edge Drawing: Once a point is selected, what would be the best approach to detect and draw the edge automatically? Are there specific functions or methods within TBC that could assist with edge identification in point clouds?

    3. Resources for Macro Development: I'm also looking for any advice on working with TBC macros in general. Is there a way to view all available variables and methods within TBC? Additionally, are there any resources or documentation that could provide guidance on how to effectively use these methods in macros?

    Any insights, advice, or resources would be greatly appreciated. I appreciate any help you can provide.



    ------------------------------
    nayef 
    ------------------------------



  • 2.  RE: Assistance with Point Cloud Edge Detection and Clicking in TBC Macro Development

    Posted 10-25-2024 16:02
    Edited by Ronny Schneider 10-25-2024 16:06

    1.

    Assuming you have the appropriate snap mode enabled then a normal coordinate picker will give you the coordinate of the cloud point.

    # in the XAML
        <Wpf:CoordinateEdit x:Name="coordCtl1" ShowElevationIf3D="True" AutoTab="True"/>
    
    
    # in python
    p1_sel = self.coordCtl1.Coordinate

    2.

    can't help you with that, haven't looked into that yet

    maybe @Fernando Calvo can, I believe he works quite a bit with point clouds

    With my current knowledge I'd have to the user select/click points on either side of the edge.

    Then retrieve cloud points from the database in the vicinity of those.

    Use something like this https://community.trimble.com/discussion/whats-the-general-purpose-of-the-new-namespace-trimblerwcore-in-202400 to compute different planes and intersect those.

    3.

    Yes, there is, through the Visual Studio object browser. Check out my video in Post 2 here https://community.trimble.com/communities/community-homepage/digestviewer/viewthread?GroupId=415&MessageKey=4fa77769-d955-4525-80ff-daca0707c274&CommunityKey=8a262af4-a35e-4e9a-9dd3-191cc785899a

    And that's basically all we have in terms of documentation. In meanwhile 6 years Trimble hasn't bothered to provide an SDK documentation as they have for the Access SDK for instance or other CAD programs do.

    At the beginning we had Gary Lantaff, who wrote the TBC sample macros, to give us some advice here on the forum. But he retired a while back. Currently we have Bryce who occasionally posts something here and tries to help. Not sure what his position within Trimble is, but I had to work out quite a bit through trial and fail on own.



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



  • 3.  RE: Assistance with Point Cloud Edge Detection and Clicking in TBC Macro Development

    Posted 10-26-2024 04:52

    Hi Nayef,

    as Ronny pointed, a simple coordinate picker will give you back the coordinates, however you need to pay attention to the object snap or leave it up to the user to have selected previously the correct object snap (point, if you want to pick points from the point cloud).

    Regarding edge detection, it´s pretty tricky and I personally don´t like it, as I have tried and used many different software packages promising automatic detection etc, however a big percentage of false recognition happen with each single solution, so I needed much more to check all and correct the false recognition, than picking myself the correct points (i.e. the wall itself and not a furniture or a picture before the wall itself).

    Having said that, I guess the "best fit" function included in TBC could help, however I didn´t try it yet from the programming side. Again, in my opinion, this is always very dangerous and also in the time that TBC needs to calculate the best fit for a selected point cloud rectangle, you can create several walls.

    I use it i.e. for detecting lowest and highest points of a very small selected region of a room, i.e. 0.50 x 0.50 m, and even though it takes many seconds to give me back the lowest and highest points, so in that time, I can pick them from the cutting plane view, and I´m sure that the correct points were selected.

    I hope this helps.

    Regards,

    Fernando



    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------



  • 4.  RE: Assistance with Point Cloud Edge Detection and Clicking in TBC Macro Development

    Posted 11-01-2024 00:51
    Edited by nayef gmail.com 11-01-2024 00:51

    Hi Fernando,

    Thank you for the detailed response, for the "best fit" function, I'll look into how it could assist with edge detection.

    Best regards,



    ------------------------------
    nayef
    ------------------------------



  • 5.  RE: Assistance with Point Cloud Edge Detection and Clicking in TBC Macro Development

    Posted 11-01-2024 00:47
    Edited by nayef gmail.com 11-01-2024 00:47

    Hi Ronny,

    Thanks for the response

    I want more clarity on the best way to use the Object Browser effectively. For example, there's a function  createCadPointsFromScan that I believe includes subsampling functionality. I'd like to understand the process of locating it in the Object Browser and figuring out how to use it within my macro. Could you share any tips on identifying parameters and usage details for this function or others like it? It would help to know the general steps for understanding and implementing such functions in TBC.

    Appreciate any advice you can offer!

    Thanks again,



    ------------------------------
    nayef
    ------------------------------



  • 6.  RE: Assistance with Point Cloud Edge Detection and Clicking in TBC Macro Development

    Posted 11-03-2024 02:21

    Hello Nayef,

    for subsampling a point cloud and retrieving points from it you can find some sample code here.

    https://community.trimble.com/discussion/whats-the-general-purpose-of-the-new-namespace-trimblerwcore-in-202400

    For using the object browser I'd suggest you watch my training videos, if you haven't done so yet.

    Specifically, video 3 (I need to reedit this one, there seems to be a double section in it) and 5 (around 16:30).

    https://www.dropbox.com/scl/fo/7j7skk1rou5ixjjqm216x/h?rlkey=jk61t50kurct88uydriocsyt1&st=oxa4cq4p&dl=0

    Keep in mind that I'm not a professional developer and those videos date back at least 2 years.

    The sample macros are from before V5.90 but still work. Just make sure to copy them to "C:\ProgramData\Trimble\MacroCommands3" instead to what the first video says.



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