CamBam
News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 18, 2017, 09:45:35 am


Login with username, password and session length


Pages: [1] 2 3 4
  Print  
Author Topic: CamBam Addon to Alibre Design  (Read 59962 times)
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« on: November 10, 2009, 04:07:26 am »

I am working on a tightly coupled bridge between CamBam and Alibre Design. It will allow the CAD design to be updated and reflected into CamBam automatically so that Machining Ops do not need to be recreated.

http://forum.alibre.com/viewtopic.php?f=10&t=10082

direct link to screen capture; http://www.spiked3.com/Povx/AD2CB.swf.html

If anyone has some ideas that would make this more useful, I would like to hear them.
Logged
Hans_G
Storm Trooper
***
Offline Offline

Posts: 109



View Profile
« Reply #1 on: November 10, 2009, 16:01:30 pm »

Whoa... that is awesome!  Keeping associtivity between MOPs and the source geometry is huge.  I didn't even realize Alibre has a plugin/addon feature.

I don't have any ideas for you at the moment, too busy drooling at what I saw in your video, but I'll keep thinking about it.  Please let us know when it's ready to download- can't wait to try it out.
« Last Edit: November 10, 2009, 18:26:46 pm by Hans_G » Logged
FrankM
CNC Ewok
*
Offline Offline

Posts: 33


View Profile
« Reply #2 on: November 10, 2009, 16:54:51 pm »

Wow, Mike I like it
good work
Logged
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« Reply #3 on: November 12, 2009, 06:07:52 am »

I am close (I think). I did some serious re-factoring and have most of the framework working, a screen capture showing Alibre Design sketch updates and preserved MOPS can be seen at

http://www.spiked3.com/Povx/ad2cb3.swf.html

The problem I have run into is that I use

                PolylineUtils.JoinPolyLines(_cbUI.ActiveView, polyLineTolerance);

to make polylines, but I really need to get the resultant polyline entities after the operation completes before I can continue in my program. I am trying to extract them from the layer they are on but as far as I can tell, JoinPolyLines uses a worker thread, and if I try to wait for it, I end up blocking it (since i'm on the same UI thread?)

If I can join polylines myself, or find a way to let the worker thread run and wait for it to finish I can then handle all supported geometry (that code is completed).  Anyone know how to accomplish either of these?

So close, yet so far Smiley
Logged
Hans_G
Storm Trooper
***
Offline Offline

Posts: 109



View Profile
« Reply #4 on: November 12, 2009, 16:08:18 pm »

I'm not sure I understand the details completely, so I'll apologize if this isn't helpful, but...

I assume you have a collection of lines and arcs coming from your Alibre add on(?).  I'll just call it an entity collection.  Some might successfully join, some might not.

Maybe you can (brute force) process the entities yourself by doing something like...

while(entityCollection.Count > 0)
{
  Polyline p = new Polyline();
  p.Add(entityCollection[0]);
  entityCollection.RemoveAt(0);
  // loop through remaining entities to see what should join
  foreach(entity e in entityCollection)
  {
     if(e can join to start or end of p)
     {
        if(e is Arc)
          p.AddArc(e);
        else if (e is Line)
          p.AddLine(e);
        entityCollection.Remove(e);   
     }
  }
  // now you can add polyline p to the CADFileTree
}

There might be a clever way to sort the entities first based on start and/or endpoint so that the entity collection is pretty much in order before you start building polylines?
« Last Edit: November 12, 2009, 16:19:15 pm by Hans_G » Logged
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« Reply #5 on: November 12, 2009, 17:27:58 pm »

That was what I was thinking I might need to do, but I had not tried it yet. I'm not sure it handles multiple regions as is. Maybe if all canJoins fail start a new polyLine?

I will give it a whirl.  Thanks

Mike

Logged
10bulls
Administrator
CNC Jedi
*****
Offline Offline

Posts: 2035


Coding Jedi


View Profile WWW
« Reply #6 on: November 12, 2009, 18:50:23 pm »

Hi Mike,

Sorry for not leaping in sooner.  Firstly a big thank you for starting such an awesome project!

Here is a bit of joining pseudo code that may help you out.

Code:
double join_tolerance = a_number;
List<Polyline> pols = list_of_pols_to_join;

PolylineJoiner2 pj = new PolylineJoiner2(pols);

if (pj.JoinPolylines(tolerance))
{
    List<Polyline> used_polys = pj.UsedPolylines;
    List<Polyline> joined_polys = pj.JoinedPolylines;
}
else
{
// no polylines were joined
}

PolylineJoiner2 is pretty fast and uses BSPs to detect near joining nodes.  It also has some logic to
detect preferable joins when there are multiple possible joins.

There is also a handy ShapeList class which has a joining method (based on the same PolylineJoiner2 class).
ShapeList does a lot of automatic shape conversions to either a polyline or region.

Good luck and give me a shout if you get stuck!
Logged
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« Reply #7 on: November 12, 2009, 19:18:37 pm »

I was just looking at that also, but would have never figured it out on my own. My brain was hurting from trying the other way. A stupid question probably; Now I am creating lines and arcs, I guess I should create Polylines instead? Do I just add all the lines and arcs to 1 Polyline and call new? That is what I'm going to try anyhow, if its wrong let me know I'll be back looking if it doesn't work.

Also, my web site is in transition so the above links may not work. I hope to have it cleaned up today. Basically I am moving everything to the primary directory http://www.spiked3.com.
Logged
blowlamp
CNC Jedi
*****
Offline Offline

Posts: 1183


View Profile
« Reply #8 on: November 12, 2009, 19:27:46 pm »

Can some explain in simple terms how this is all working, and when a version is going to be available for ViaCAD?  Wink Grin Please.

Martin.
Logged
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« Reply #9 on: November 12, 2009, 20:44:54 pm »

ok, it ended up like this;
------------------------------
void UIAddSelect(bool Join, String layerName, List<Entity> entities)
        {
            if (entities == null)
                return;

            _cbUI.CADFileTree.CADFile.SetActiveLayer(layerName);

            if (Join)
            {
                List<Polyline> startPolys = new List<Polyline>(entities.Count);
                foreach (Entity E in entities)
                {
                    if (E is Line)
                        startPolys.Add(((Line)E).ToPolyline());
                    else if (E is Arc)
                        startPolys.Add(((Arc)E).ToPolyline());
                    else
                        _cbUI.InsertEntity(E);
                }

                if (startPolys.Count > 0)
                {
                    Polyline[] inPolys = startPolys.ToArray();
                    Polyline[] joinedPolys = Polyline.JoinPolylines_NEW2(ref inPolys, polyLineTolerance);
                    foreach (Entity E in joinedPolys)
                        _cbUI.InsertEntity(E);
                }
            }
            else
            {
                foreach (Entity E in entities)
                    _cbUI.InsertEntity(E);
            }
            _cbUI.ActiveView.SelectAllLayerGeometry();
        }
------------------------------

That seem to do the trick - which means - the program is in a state that it is fun to play with Smiley

It is not ready for real testing, but its fun to play with if you have Alibre obviously. I know I need to handle geometry updates were the geometry was translated after initial import.

I will post up new screen captures and maybe code and binaries tonight once I get my web site straightened out.

Thanks everyone!
Logged
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« Reply #10 on: November 13, 2009, 01:57:13 am »

I have updated my web site. There may be some broken links and such, let me know if you run across anything.

The Alibre to CamBam bridge page is up and has a download available.

Blowlamp, there is an explanation of how it is working on the page. It will be ready for ViaCAD as soon as you convert the code Smiley

http://www.spiked3.com/Alibre2CB.html

Logged
Hans_G
Storm Trooper
***
Offline Offline

Posts: 109



View Profile
« Reply #11 on: November 13, 2009, 15:55:10 pm »

Mike, thanks.  Can't wait to take a look at it after work today.
Logged
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« Reply #12 on: November 14, 2009, 17:49:42 pm »

Anyone tried it yet? Have any luck?
Logged
Hans_G
Storm Trooper
***
Offline Offline

Posts: 109



View Profile
« Reply #13 on: January 24, 2010, 00:32:13 am »

I started working with this today and it seems to work great.  I haven't done much with Alibre lately, but now I've got something going.  Nice to skip the 2d and dxf export steps and go straight to CamBam. 
Logged
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« Reply #14 on: January 24, 2010, 01:34:43 am »

Over 2 months Smiley You are spending entirely too much time on real life Cheesy
Logged
Pages: [1] 2 3 4
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.136 seconds with 18 queries.

Copyright © 2008 HexRay Ltd. | Sitemap