Maximum number of objects? A more elegant way to group them?

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!
daidalosnet
Posts: 5
Joined: Thu Jan 31, 2013 9:07 pm

Maximum number of objects? A more elegant way to group them?

Postby daidalosnet » Thu Jan 31, 2013 10:11 pm

I have a cylinder(hole in a box) and need around 250,000 copies of the same object, neatly arragned in an array.

I tried to use this macro:

http://sourceforge.net/apps/mediawiki/f ... _ArrayCopy

to copy the object, but FreeCAD always crashes and I think 250000 objects are
simply way to much for this program.

Is there a simpler way to group these objects, since it's a periodic array? I don't want to create 250000 objects by hand ; )

Thanks!
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Maximum number of objects? A more elegant way to group them?

Postby shoogen » Thu Jan 31, 2013 10:20 pm

please only use one feature
so instead of assigning the newshape to a new feature, you could fuse all the shapes together.

Code: Select all

oldshape=None
        for column in range(u[0]):
            for row in range(v[0]):
                if (column != 0) or (row != 0):
                    delta = FreeCAD.Vector(column*u[1],row*v[1],0)   
                    newshape = sel.Shape.copy()
                    newshape.translate(delta)
                    if oldshape is not None:
                       oldshape=oldshape.fuse(newshape)
                    else:
                       oldshape=newshape
          newobject = FreeCAD.ActiveDocument.addObject("Part::Feature",name)
          newobject.Shape = oldshape
daidalosnet
Posts: 5
Joined: Thu Jan 31, 2013 9:07 pm

Re: Maximum number of objects? A more elegant way to group them?

Postby daidalosnet » Thu Jan 31, 2013 10:29 pm

Thanks for your answer! But I'm afraid I'm not a good programmer. I tried to replace the if-else statement in the linked macro by your modified if-else statement.
Could you maybe post the complete macro with the right placement of your modification?