Holes from imported POINTS

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!
openBrain
Posts: 1959
Joined: Fri Nov 09, 2018 5:38 pm

Re: Holes from imported POINTS

Postby openBrain » Sat Mar 16, 2019 11:29 pm

massen wrote:
Sat Mar 16, 2019 10:59 pm
Couldn’t figure out how to download version 0.18, Hannu.
At the time I'm writing, the 0.18 RC are available on this page.
But as NormandC told 0.18 is under release process, and official installers should be soon available (despite on my side, I prefer to use a Zip archive under Windows).
I have considered something like openBrain’s option #1, and now you have encouraged me to try it. I ruled out #2 as I’m not a programmer, but a middle+ age physicist.
Don't be that harsh with yourself. Handwriting some SVG in Notepad is a nice evidence that you're ready to fight some obstacles. :lol:
I think you have to weight both options according the occurence of your need.
If you have tons of file to import, maybe #2 is worth spending some time struggling with Python as it will lead to a more "automated" process. Starting from an existing importer as SVG or IDF should make that reachable.
Oppositely if you don't have so much files, option #1 is indeed probably easier to implement. I'm not expert but maybe Matlab/Octave can be programmed to directly generate SVG format. On my side, I would have do it using sed/awk commands using eg. this Busybox build for Windows. ;) If you're interested in this latter solution and provide one of your point cloud file, I can have a look.
massen
Posts: 5
Joined: Sat Mar 16, 2019 10:59 am

Re: Holes from imported POINTS

Postby massen » Sat Mar 16, 2019 11:32 pm

Hello NormandC,
I’m making ion grids out of graphite disks, where ions from a plasma are ejected through the holes.
I have had the drawings done for me with AutoCAD or a similar Autodesk program, but now I want to do them myself and don’t want to spend the $$$.
Maybe importing 2000 circles will be CPU demanding. We’ll see.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Holes from imported POINTS

Postby NormandC » Sat Mar 16, 2019 11:45 pm

openBrain wrote:
Sat Mar 16, 2019 11:29 pm
If you have tons of file to import, maybe #2 is worth spending some time struggling with Python as it will lead to a more "automated" process.
And why not ask on the Python scripting and macros forum for a script to generate a Part compound of points (Draft or Part entities) from a point cloud file? Surely this should not be difficult for python experts over there.

Then, it's just a matter of creating a cylinder, selecting it then the compound, and press the Draft PointArray tool.
openBrain
Posts: 1959
Joined: Fri Nov 09, 2018 5:38 pm

Re: Holes from imported POINTS

Postby openBrain » Sat Mar 16, 2019 11:58 pm

NormandC wrote:
Sat Mar 16, 2019 11:45 pm
And why not ask on the Python scripting and macros forum for a script to generate a Part compound of points (Draft or Part entities) from a point cloud file? Surely this should not be difficult for python experts over there.
Looks to me as an interesting intermediate solution for a medium volume of files. :) But there are still some manual operations.
Coding a custom importer, you can envisage to get an array of cylinders that you can directly cut with a BOP. ;) And maybe even to programmatically generate the complete part. :D
And, to be honest, I'm also not very familiar with Draft tools. :lol:
User avatar
meme2704
Posts: 2926
Joined: Sat Apr 01, 2017 2:47 pm
Location: Vosges

Re: Holes from imported POINTS

Postby meme2704 » Sun Mar 17, 2019 10:11 am

Your cloud of points is not completely random, it must respond well to an angular logic and position
I think there are at least 6 identical sectors, so the job is already 6 times shorter, it remains to define the placement logic for 1
User avatar
pl7i92LCNC
Posts: 176
Joined: Tue Mar 12, 2019 3:03 pm
Location: RLP DE

Re: Holes from imported POINTS

Postby pl7i92LCNC » Sun Mar 17, 2019 12:34 pm

hi it is real eays as with open a python console
i did make a Video if it will help you
https://www.youtube.com/watch?v=85WYZzHrEnQ

BUT
SELECT all points
THEN IN The Python consol first check if you got realy points by

Code: Select all

for v in Gui.Selection.getSelection()[0].Shape.Vertexes: print v.Point
Output shout show Vertex Point

GENERATE the Holes
SELECT all points as you did bevor in the VIEW

Code: Select all

import Draft,Part 
from FreeCAD import Base 
sel = Gui.Selection.getSelection()
for x in xrange(len(sel)):
     for v in sel[x].Shape.Vertexes:
          pn = v.Point pn.z = -4 
          print pn 
          Part.show(Part.makeCylinder(3,4,pn,Base.Vector(0,0,1),360))

the pn = v.Point pn.z = -4 is the position low Z
THEN yust compound all and do a BOOL
massen
Posts: 5
Joined: Sat Mar 16, 2019 10:59 am

Re: Holes from imported POINTS

Postby massen » Sun Mar 17, 2019 6:08 pm

pl7i92LCNC, my cloud points don’t seem to behave as the vortex points. No success.

Regarding my progress with the SVG approach.

I added a few lines of code to my Octave program. In addition to generating the hole pattern etc., it now also writes the pattern to a SVG file. Then, I imported the SVG files into FreeCAD and the hole pattern appeared nicely in the drawing, but…

The position and radius of the circles were scaled to about 1/3 of the original dimension in the SVG file. In order to verify this scaling flaw, I manually wrote a simple SVG file with circles of radius 25, 50, and 75mm. They all appeared in FreeCAD scaled to approximately 1/3. I researched and found that also other members have experienced scaling problems, when importing SVG files.

Since I’m gradually getting more confident in writing code, I will now give up the current approach and instead accept the Phyton script challenge…
chrisb
Posts: 18038
Joined: Tue Mar 17, 2015 9:14 am

Re: Holes from imported POINTS

Postby chrisb » Sun Mar 17, 2019 6:29 pm

IIRC microelly2 has worked on point clouds.
microelly2 wrote: ping
openBrain
Posts: 1959
Joined: Fri Nov 09, 2018 5:38 pm

Re: Holes from imported POINTS

Postby openBrain » Sun Mar 17, 2019 6:30 pm

massen wrote:
Sun Mar 17, 2019 6:08 pm
Since I’m gradually getting more confident in writing code, I will now give up the current approach and instead accept the Phyton script challenge…
Excellent ! Wish you to succeed.
Maybe you can find some inspiration in the IDF importer which is a simple file parser + object generator. ;)
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Holes from imported POINTS

Postby NormandC » Sun Mar 17, 2019 6:42 pm

massen wrote:
Sat Mar 16, 2019 11:32 pm
Hello NormandC,
I’m making ion grids out of graphite disks, where ions from a plasma are ejected through the holes.
Forgot to thank you for the reply, it's always interesting to find out what people intend to use FreeCAD for. I had no idea such things existed, actually.