CamBam
News:
 
*
Welcome, Guest. Please login or register. April 25, 2014, 01:37:57 am


Login with username, password and session length


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

Posts: 8


View Profile
« Reply #15 on: March 21, 2010, 20:42:02 pm »

This is my first post here.  New to CNC and Cambam but learning quickly.  I ran across this thread and immediately tried the AD2CB addon.  It didn't initially work but Mike found the problem, corrected the download on his website and got me up and running.  This is an excellent time saving tool by eliminating the need to convert 3D drawings to 2D views for DXF export.  Great work Mike, I hope other people find this tool useful.

Cadwiz
Logged
lesspaul
CNC Ewok
*
Offline Offline

Posts: 5


View Profile
« Reply #16 on: March 24, 2010, 19:41:46 pm »

Like CadWiz I had some problems with the plugin which were quickly resolved. If you tried the plugin earlier and had troubles, I strongly recommend you download it again and give it another try. It is a great tool and will save you time and spare you grey hairs.
Logged
FatFreddie
CNC Ewok
*
Offline Offline

Posts: 40


View Profile
« Reply #17 on: April 19, 2010, 12:38:55 pm »

Hi,

I'm attempting to add B-Spline support to Mike's Alibre add on. I've got the code reading the Alibre splines and creating a CamBam spline but the spline does not display in CamBam even though the points are there.

If anyone's got any ideas I'd appreciate them.

Code:
IADSketchBspline S = (IADSketchBspline)SF;
int pOrder, pNumCtlPoints, pNumKnots;
bool pIsRational, pIsClosed, pIsPeriodic;
S.GetDefinition(out pOrder, out pNumCtlPoints, out pNumKnots, out pIsRational, out pIsClosed, out pIsPeriodic);
Array pCtlPoints = new double[pNumCtlPoints * 2];
Array pKnotVector = new double[pNumKnots];
Array pWeights = new double[pNumCtlPoints * 2];
S.GetBsplineData(ref pCtlPoints, ref pKnotVector, ref pWeights);
// create a CamBam spline
CamBam.CAD.Spline cbs = new CamBam.CAD.Spline();
Point3FArray ctlPoints = new Point3FArray();
for (int k = 0; k < pCtlPoints.GetLength(0); k += 2)
{
  ctlPoints.Add(new Point2F((double)pCtlPoints.GetValue(k) * scaleFactor, (double)pCtlPoints.GetValue(k + 1) * scaleFactor));
}
cbs.ControlPoints = ctlPoints;
cbs.Knots = (double[])pKnotVector;
cbs.Weights = (double[])pWeights;
entities.Add(cbs);

The attached file should have a roughly circular spline in the gap between the two polylines.

Mark

* Imported B-Spline 1-0.cb (3.21 KB - downloaded 143 times.)
Logged
10bulls
Administrator
CNC Jedi
*****
Offline Offline

Posts: 1948


Coding Jedi


View Profile WWW
« Reply #18 on: April 19, 2010, 14:39:15 pm »

Hi there,

The splines in CamBam are based on DXF splines.
I've just had a quick look at your file and notice a couple of things.

Firstly, the weight vector looks wrong.  There should be as many items in this vector as there are control points.
Each control point is 'weighted' by it's corresponding entry in this vector.
The weight vector in the .cb file has 2 x as many weights as control points and they are all 0, so when the spline is rendered, each control point is weighted as 0... so it just collapses to a point.
Changing the weight vector to 8 x 1s starts to give us something.

Next problem is a parameter of the CamBam spline called Degree, 1 (or 0) is linear, 2 is quadratic, 3 is cubic etc.
In this example, I think Degree should be 3 as the number of knots is then the number of control points + degrees + 1.

That looks a bit better, but I'm not sure what shape you were aiming for.  I think if you get the right weight vector, it should come good.

I hope this helps!


* Imported B-Spline 1-0 (10B).cb (3.04 KB - downloaded 150 times.)
Logged
FatFreddie
CNC Ewok
*
Offline Offline

Posts: 40


View Profile
« Reply #19 on: April 20, 2010, 10:00:38 am »

Thanks Andy,

that seems to have sorted it. No idea why Alibre is not populating the weights properly but putting 1 in gets a pretty close copy of the shape and you were right, the degree needs setting to cubic.

Regards,
Mark
Logged
10bulls
Administrator
CNC Jedi
*****
Offline Offline

Posts: 1948


Coding Jedi


View Profile WWW
« Reply #20 on: April 20, 2010, 12:09:05 pm »

Just noticed the order information... you should be able to use that to set the degree, so degree=order-1.

Also, the pIsRational might give us a clue regarding the weights.  My understanding is if this is false then the points aren't weighted.  CamBam currently always applies the weight vector so you could put a check in your plugin so that if rational then use the weights, otherwise create an array of 1s.

There are some spline flags in CamBam that you could set.

Spline.Rational
Spline.Closed
Spline.Periodic

These flags are not currently used, but it wouldn't hurt to populate them so in future CamBam releases I may make use of them.  For example if the rational marker is false, the weights could be ignored.
Although it's been a while since I wrote the spline code, so I would need to double check this.
Logged
FatFreddie
CNC Ewok
*
Offline Offline

Posts: 40


View Profile
« Reply #21 on: April 20, 2010, 19:11:35 pm »

Thanks for the additional info - I've put your mods in so hopefully it'll be a bit more future proof.

I'm now looking at the part that associates the primitives with the MOPs. Currently there are some assumptions made to get it to work which do not always produce the correct results when updating a model. To fix this I'm trying to persist the Alibre IDs (which are numbers albeit in string format) through to CamBam. There are two problems here...

1. Polylines are built from multiple Alibre elements. I was planning to persist the element ID into the individual polyline segments so that I can compare which elements are in which polylines and set the ID appropriately. I think this might work but can't test due to problem 2.

2. Adding the primitives with ID's already set works the first time but when CamBamUI.InsertEntity() is called from the update routine it fails with an exception stating that the ID already exists (despite it having been deleted). Is there any way round this?

Thanks
Mark
Logged
Hans_G
Storm Trooper
***
Offline Offline

Posts: 107



View Profile
« Reply #22 on: June 11, 2010, 18:54:08 pm »

Can anyone post the latest .dll here?  It's not on Spiked3's website anymore.  Thanks!

edit:  whoops, it's still there... http://www.spiked3.com/AlibrePlugins.html
« Last Edit: June 12, 2010, 15:13:47 pm by Hans_G » Logged
72Zorad
Storm Trooper
***
Offline Offline

Posts: 109


View Profile
« Reply #23 on: July 29, 2010, 04:38:14 am »

Is this no longer offered?  All of his links are broken for me.

Thanks,

Mark
Logged
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« Reply #24 on: July 29, 2010, 05:13:13 am »

yeah, I'm taking a break from it for a little while - the amount of effort to support was a little more than I could handle at the moment. 
I probably will make it available again when the next version of CamBam is available - but I am pretty sure I am going back to my original plan of source code only.  That way you kind of will have to be able to support yourself with it.
Logged
Hans_G
Storm Trooper
***
Offline Offline

Posts: 107



View Profile
« Reply #25 on: February 21, 2011, 16:44:19 pm »

Does anyone have a version of this for 0.9.8?  This was such a great idea, I'd love to see it revived.  I emailed spiked3 asking for the source but never heard from him.  Not sure what the etiquette here is, but if anyone can post a version for 0.9.8 I would sure appreciate it.  Or if anyone can share the source??? 
Logged
spiked3
CNC Ewok
*
Offline Offline

Posts: 49


View Profile
« Reply #26 on: May 23, 2011, 15:31:04 pm »

hey guys. due to medical problems, I think my machining (and most coding) days are over.
I have had a couple of requests for this add-on. anyone is welcome to take the source and distribute it in any form.

http://dale.spiked3.com/ad2cb.zip

Mike aka spiked
Logged
staffshome
CNC Ewok
*
Offline Offline

Posts: 2


View Profile
« Reply #27 on: May 23, 2011, 15:33:22 pm »

Hi Mike,
thanks for the update,hope you recover ok.
I have tried the link & it fails (cannot find Site.

Best regards Adrian
Logged
10bulls
Administrator
CNC Jedi
*****
Offline Offline

Posts: 1948


Coding Jedi


View Profile WWW
« Reply #28 on: May 23, 2011, 15:46:15 pm »

Thank you so much for that Mike.
I hope you are at least managing to get a bit of robot tinkering done.

This link seems to work OK.
http://www.spiked3.com/ad2cb.zip
Logged
staffshome
CNC Ewok
*
Offline Offline

Posts: 2


View Profile
« Reply #29 on: May 23, 2011, 15:59:30 pm »

Andy
Thanks for link update
I will look into Mike's source & see where he got to.
I think everyone who already uses mike code & people like me who are going to, owe Mike a very big thank you for donating it to forum members gratis.

regards Adrian
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.172 seconds with 17 queries.

Copyright © 2008 HexRay Ltd. | Sitemap