Inspecting Point cloud

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Adam Jelínek
Posts: 13
Joined: Thu Jun 09, 2016 6:42 am

Inspecting Point cloud

Postby Adam Jelínek » Thu Jun 09, 2016 11:17 am

Hello,

Im looking for an advise, how to achieve desired ispection.

I want to import cloud of points (measured by probe on CNC - in real) onto surface and visualise if they are in set tolerance or not. I mean - if tolerance is set to 50 microns and the imported point is 60 microns above surface, the imported point will turn red.

What I did so far is solve problem with importing. Imported nominal points (e.c. 10 5 10) and in another cloud measured points (10 5 10.3). Then I tried to play with inspection workbench, but got nowhere.


Any ideas please?
User avatar
microelly2
Posts: 4319
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Inspecting Point cloud

Postby microelly2 » Thu Jun 09, 2016 11:27 am

What do you want to check the data against?
Do you have a part or mesh?

If you import the data as Point Cloud using the Points workbench you have an object with all point data.
Now check whether each points belong to your part.
and create a new set of bad points.

see
http://www.freecadweb.org/wiki/index.ph ... oShape_API

isInside ( Vector,float,Boolean )
Description: Checks if a point is inside a solid with a certain tolerance. If the 3rd parameter is True a point on a face is considered as inside
Adam Jelínek
Posts: 13
Joined: Thu Jun 09, 2016 6:42 am

Re: Inspecting Point cloud

Postby Adam Jelínek » Thu Jun 09, 2016 11:49 am

I have a part (.iges).

Now, when I looked at your link, I think, I want to check the points against the model (nominal surface):

distToShape ( TopoShape )
Description: Calculates the minimum distance between this and a given TopoShape.
Returns: float<minimum distance>,list<nearest points>,list<nearest subshapes & parameters>

And resolve the minimum distance - if in given tolerance - view the point as green / out of tolerance - view the point as red.

Now - as a user - I would export a picture (jpeg) and a log (txt file) with nominal value, measured value, given tolerance, minimum distance parametr and valuation if the point is or is not i that tolerance. And use it in protocol. Or that is my idea.

Is that possible? Or at least the graphical part?
User avatar
r-frank
Posts: 2181
Joined: Thu Jan 24, 2013 6:26 pm
Location: Möckmühl, Germany
Contact:

Re: Inspecting Point cloud

Postby r-frank » Thu Jun 09, 2016 1:15 pm

Hello.

At least with CloudCompare your task seems possible.

Roland
Deutsche FreeCAD Tutorials auf Youtube
My GrabCAD FreeCAD-Projects
FreeCAD lessons for beginners in english

Native german speaker - so apologies for my english, no offense intended :)
Adam Jelínek
Posts: 13
Joined: Thu Jun 09, 2016 6:42 am

Re: Inspecting Point cloud

Postby Adam Jelínek » Thu Jun 09, 2016 1:37 pm

r-frank wrote:Hello.

At least with CloudCompare your task seems possible.

Roland

Seems interesting. But is it realy a good idea to start with a completely new program (for me)? I think, that what I want could be done in FreeCAD and even easily. Just if I knew how to.

But I will most certainly look at the CloudCompare. Thank you.
User avatar
microelly2
Posts: 4319
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Inspecting Point cloud

Postby microelly2 » Thu Jun 09, 2016 1:39 pm

bp_021.png
bp_021.png (20.1 KiB) Viewed 2305 times
This is the first example script for a distance 0.1

Code: Select all

import Points

# your point set
Points.insert("yourpath/aaa.asc",'pointcloudtest')
pts=App.ActiveDocument.ActiveObject
pts.ViewObject.hide()

# the exact model
App.ActiveDocument.addObject("Part::Box","Box")
mymodel=App.ActiveDocument.ActiveObject
mymodel.ViewObject.Transparency=80
App.ActiveDocument.ActiveObject.ViewObject.ShapeColor=(1.0,1.0,0.0)

App.ActiveDocument.recompute()


ptin=[]
ptoff=[]
for p in pts.Points.Points:
	if mymodel.Shape.isInside(p,0.1,True):
		ptin.append(p)
	else:
		ptoff.append(p)


# the good points
pin=Points.Points(ptin)
Points.show(pin)
App.ActiveDocument.ActiveObject.ViewObject.ShapeColor=(0.0,1.0,0.0)

# the bad points
pout=Points.Points(ptoff)
Points.show(pout)
App.ActiveDocument.ActiveObject.ViewObject.ShapeColor=(1.0,.0,0.0)

Gui.SendMsgToActiveView("ViewFit")



rename aaa.asc.zip to aaa.asc

We can make a finer grouping of the points for some threshold distances.
The next step can be a detailed calculation and visualization of the quality.
I will think about a common useable datamodel for this process ...

disttoShape is a little bit harder because I need a shape and not a point cloud, so I don't know about the complexity and execution time of that approach.
Attachments
aaa.asc.zip
(184.05 KiB) Downloaded 85 times
Adam Jelínek
Posts: 13
Joined: Thu Jun 09, 2016 6:42 am

Re: Inspecting Point cloud

Postby Adam Jelínek » Thu Jun 09, 2016 1:58 pm

This is absolutely great. This is what I desire.

But I see, I have to start with coding, so I can participate on solution.

As I understand it - if I will learn Python, I will be able to do such as modifications to FreeCAD, right?
User avatar
microelly2
Posts: 4319
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Inspecting Point cloud

Postby microelly2 » Thu Jun 09, 2016 2:58 pm

Adam Jelínek wrote:
As I understand it - if I will learn Python, I will be able to do such as modifications to FreeCAD, right?
Yes of course. FreeCAD is very powerful and if you are able to combine the methods for your needs you can automate lots of your work.
I can support you on your first steps and then you will change and extend the scripts step by step.

There are good pages about python programming in the FreeCAD wiki for the first.