Cutlist4.1 #2: Cutlist minor enhancements

  • Advertise with us
Blog entry by daltxguy posted 07-28-2010 02:04 PM 2709 reads 1 time favorited 11 comments Add to Favorites Watch
« Part 1: The first pre-release of cutlist 4.1 sketchup plugin Part 2 of Cutlist4.1 series Part 3: Cutlist - more output enhancements »

I had a chance to add a few minor enhancements.
The link is still the same for the ‘pre’ version as before, now up to v4.1.0.4
Anyone downloading the ‘pre’ version will automatically get this change

The list of changes:
  1. Additional characters which may end up in titles or material names which would otherwise give problems are now properly converted to display in html. These characters are the space(), single quote (‘), less than (<), greater than (>) and dash (-).
  2. The twiddle (~) character which SU adds to measurements when they are not completely accurate is now removed from the window display ( it was already removed from csv and clp files but not on the display)
  3. Part number ( ie components, sheet parts or hardware parts) are now ‘fixed width’. ie: whereas a part before might have been labeled for example as P-2-1, now it will be P-002-01. Part number are 3 digits and sub-part numbers are 2 digits. Also it’s set up now so this could become an option in the future if it’s not quite right for everyone. Why is this important? Some people sort their parts by different criteria for different purposes but if you go to put it back in the original order by sorting on part number, then it does not end up in numerical order again.
  4. Enhanced help on some fields ( some descriptions were incomplete or inaccurate after changes)

Don’t despair if you don’t see your request here yet. Stay tuned.

-- If you can't joint it, bead it!

11 comments so far

View TheOldTimer's profile


226 posts in 2692 days

#1 posted 07-28-2010 07:47 PM

Steve: I downloaded this program last week and am completly amazed on how well it works. I too would like to thank you for your effort and hard work on keeping this porgram up-dated and current.

-- TheOldTimer,Chandler Arizona

View ToddMurdock's profile


3 posts in 2985 days

#2 posted 07-29-2010 12:32 AM


Thanks again! I’ll second Dave’s comment about the tilde—CLP will not import those components. With out the tilde displayed, I’ll have to check every component manually to find my errors.


View daltxguy's profile


1373 posts in 3520 days

#3 posted 07-29-2010 01:53 AM

Dave/Todd – Ok, Thanks for the feedback about the tilde. Point taken. I’ll remove that change (it’s just 1 line)
It’s true that it does usually indicate an error ( a line is not parallel, for example)
In the short term, until I update the files, if you want to remove it just remove line 169 from the ruby script ( CutListAndMaterials.rb)

OldTimer- thanks!

-- If you can't joint it, bead it!

View daltxguy's profile


1373 posts in 3520 days

#4 posted 07-29-2010 02:17 AM

Glad you found it Dave. I hadn’t even thought that line numbers might not be the best description. I work with code editors all day long and line numbers are like the air I breathe.

The line looks like this:

val = val.gsub(/[~]/, ””) #remove the SU generated twiddle for inaccurate measurements

Either remove it or add a ’#’ to the front of the line

Now, do you call # a hash? octothorpe? or pound? haha

-- If you can't joint it, bead it!

View Quimper's profile


8 posts in 3194 days

#5 posted 07-29-2010 12:12 PM

Hi Steve,
Thank you for this new release, I’ve got some issues in the plugin: The screen display of the cutlist without ”~” and all the components/groups listed:

Screen Capture

The CSV Cutlist:
Part#;Quantity;Description;Length(X);Width(Y);Thickness(Z);Cubic m (per);Cubic m (total);Total Length (m);Material;
C-001;1; 45×145 Traverse Mur;7140;145;45;0.046589;0.046589;7.14;douglas4F;
C-002;1; LVL 45×220;7560;220;45;0.074844;0.074844;7.56;Color
C-003;2; TH Mur 1;~ 3773;145;45;0.024618;0.049236;7.5458;douglas4F;
C-004;1; montants mur pignon;~ 852;145;45;0.005562;0.005562;0.8524;douglas
C-005;1; montants mur pignon;~ 1398;145;45;0.009125;0.009125;1.3984;douglas4F;
C-006;1; montants mur pignon;~ 1216;145;45;0.007937;0.007937;1.2164;douglas
C-007;1; montants mur pignon;~ 1034;145;45;0.00675;0.00675;1.0344;douglas4F;
C-008;1; montants mur pignon;~ 488;145;45;0.003187;0.003187;0.4885;douglas
C-009;1; montants mur pignon;~ 1580;145;45;0.010312;0.010312;1.5804;douglas4F;
C-010;1; montants mur pignon;~ 670;145;45;0.004375;0.004375;0.6705;douglas
C-011;1; montants mur pignon;~ 380;145;45;0.002481;0.002481;0.3802;douglas4F;
C-012;1; montants mur pignon;~ 1398;145;45;0.009125;0.009125;1.3984;douglas
C-013;1; montants mur pignon;~ 852;145;45;0.005562;0.005562;0.8524;douglas4F;
C-014;1; montants mur pignon;~ 488;145;45;0.003187;0.003187;0.4885;douglas
C-015;1; montants mur pignon;~ 1034;145;45;0.00675;0.00675;1.0344;douglas4F;
C-016;1; montants mur pignon;~ 1216;145;45;0.007937;0.007937;1.2164;douglas
C-017;1; montants mur pignon;~ 1580;145;45;0.010312;0.010312;1.5804;douglas4F;
C-018;1; montants mur pignon;~ 380;145;45;0.002481;0.002481;0.3802;douglas
C-019;1; montants mur pignon;~ 670;145;45;0.004375;0.004375;0.6705;douglas4F;
C-020;2; montants mur pignon;~ 1649;145;45;0.010757;0.021514;3.2972;douglas

Total Component Cubic m

Component Materials
Material;Cubic m;

The CutlistImport List:

Part #;Sub-Assembly;Description;Copies;Thickness(Z);Width(Y);Length(X);Material Type;Material Name;Can Rotate;
C-001; LVL 45×220; LVL 45×220;1;45;220;7560;DL;ColorD02;yes;
C-002; 45×145 Traverse Mur; 45×145 Traverse Mur;1;45;145;7140;DL;douglas
C-003; TH Mur 1; TH Mur 1;2;45;145;~ 3773;DL;douglas4F;yes;
C-004; montants mur pignon; montants mur pignon;
18;45;145;~ 380*;DL;douglas4F;yes;

In both list, there is the ”~” character showing up, and in the cutlistimport file, all the groups with the same name are joined together.
I use the last Sketchup Pro French release, on Windows XP.
I can manage those issues with a text editor, but I wanted to share that with you.
However, you do a very nice job, it’s a wonderful plugin.
Sorry for the formatting, I don’t understand the lumberjocks’s explanation!
Best regards

-- Philippe @

View daltxguy's profile


1373 posts in 3520 days

#6 posted 07-29-2010 12:28 PM

Darn. There is always someone who actually checks what I say!
That’s clearly not what I meant to have done with the ’~’ sign!
I’ll also check on the CLP file combining parts with the same name but obviously different sizes!
I’ll get these fixed asap create another version.

Thanks for bringing it to my attention, Philippe. My fault for not testing everything!

-- If you can't joint it, bead it!

View Will Stokes's profile

Will Stokes

265 posts in 2960 days

#7 posted 07-29-2010 03:39 PM

Steve, I started digging through you Ruby code in part becuase I’m curious how you were doing symbol conversion for HTML and also becuase I’d love to find a way to fix this rendering issue on Macs. I’m not experienced with Ruby (I’m more of a C++/Qt guy) so I havn’t distilled the problematic part with Mac’s yet, but I did think you’d appreciate two suggestions:

-you could clean up the tohtml function defined in CutListAndMaterials.rb like so:

def tohtml
val = self.gsub(/[&]/, “& amp;”) #convert & first so we don’t convert the conversions!
val = val.gsub(/[ ]/, “& nbsp;& nbsp;”)
val = val.gsub(/[“]/, “& quot;”)
val = val.gsub(/[‘]/, “& apos;”)
val = val.gsub(/[<]/, “& lt;”)
val = val.gsub(/[>]/, “& gt;”)
val = val.gsub(/[-]/, “& ndash;”)
return val


This avoids using HTML codes that consist of # + a number. Also, I’ve attempted (not tested) to convert double spaces to two consequtive nbsp’s. This potentially avoids having to convert single spaces, only double spaces.

I wonder if the Ruby file could be broken up across several files, preferably within the cutlistui directory. At ~5k lines this ruby script is getting a little hard to scroll through. It might be nice to move the HTML, SVG, CVS, layout etc into separate scripts. That way if someone wanted to dive into say the SVG code and see if they could help out it would be easier to do so.

My impression is that the HTML layout is done by HtmlOutputDriver. Specifically, I noticed:

def drawBoard(penThickness,color,label,x,y,length,height)
... html += ” cutlistLayout.fillRect(#{x},#{y},#{length},#{height});”

It looks like you’re building up an HTML string that really is a bunch of JavaScript calls. Aka to draw a rect in the layout your HTML will run the “cutlistLayout.fillRect” JavaScript function. My guess is that on a Mac when you display the layout it cannot find the appropriate .js file and as a result cannot run any of the cutlistLayout JavaScript functions, hence you get an empty display. This is supported by the comment in your code:

  1. html renderer to write a java script to draw
  2. using wz_jsgraphics.js

Indeed cutlistresult.html references that .js file:


View daltxguy's profile


1373 posts in 3520 days

#8 posted 07-29-2010 04:00 PM


It’s a long story and you’re sort of on the right track but I’ll write more about it later – but it’s 2am here.
I believe that Safari won’t let you run the javascript, not that it can’t find it.
Yes, it is possible to fix with the recent changes I’ve made to allow printing of the layout page, I generate a pure html script in parallel to the javascript one. ( The javascript consists of calls to utilities in wz_jsgraphics.js – which is 3rd party but I’ve now modified) The pure html version using some funny quirks of html divs to draw squares but is not as accurate or as pretty but could produce a functional display- but I think there are problems here too because it is generated when the scripts are run.

I hear ya about file size, lots of things are WIP. I don’t get paid enough to spend as much time on it to do everything :) I have a list as long as my arm of things I want to do…

-- If you can't joint it, bead it!

View Will Stokes's profile

Will Stokes

265 posts in 2960 days

#9 posted 07-29-2010 04:16 PM

Interesting. I wonder, can you embed an SVG in an HTML file? That would provide nice quality and get around the execute javascript issue. If you’d like me to take a stab at cleaning parts up or making minor changes let me know. I’m entirely new to Ruby but this would be a good excuse for me to learn it. It appears to use a C/Java style syntax and is pretty easier to understand. A lot easier for me to understand than Objective-C.

View daltxguy's profile


1373 posts in 3520 days

#10 posted 07-31-2010 12:05 AM

Hi Will,

Embedding svg was always a possiibility and I considered it – the problem is that Windows IE and Safari did not natively support SVG at the time (maybe it has improved since then). I didn’t want people to install it and be disappointed because it would not produce anything right away, saying it’s shit and tossing it out – you know how it is with most things you download for free :)

Ruby is pretty simple – to me it’s just another language. If you know any other language, you can manage. Many years ago when I studied computer science, we had one course which focused on doing things optimally using different languages ( most of which you will have never heard of), we had an assignment a week, each in a different language. It was good training to learn a language in a day! Ruby can be learned in a few hours…

I appreciate any help. You are probably one of a very few people who has offered. ( Imagine the odds of being able to program and being a woodworker at the same time!). I don’t currently have a nice way of sharing the development. I had considered creating an open source project on Google Code or SourceForge but didn’t want to make the commitment unless I knew there was a benefit.

If you have some thoughts, let me know.

I tend to add new things in the winter ( now, for me) and then nada for the rest of the year.

-- If you can't joint it, bead it!

View Will Stokes's profile

Will Stokes

265 posts in 2960 days

#11 posted 07-31-2010 01:22 AM

yeah, it looks like Ruby uses a C style syntax so I basically grasp it immediately. I did a quick google search and it looks like to include another ruby file you just do:

load ‘filename.rb’

That’s easy enough. I would like to help contribute and perhaps the first and easiest thing I can do is help break apart the code across multiple files, one for SVG, one for HTML, one for CSV, etc. that said, I don’t want to do this while you’re making changes as well. Once we have separate files it’ll be far easier for us to work on separate files and make mergings changes back together much easier.

I’m not terribly familiar with Historically I’ve used sourceforge (Album Shaper, Reveal, Presenter, Showcase), but really the choice is up to you. I’m most familiar with CVS and SVN, not git, but again the choice is up to you. I don’t think we need the flexibly (and associated complexity) of a distributed versioning system, so I’d prefer to use SVN over git.

I think the best thing to do is for you to create a project on or sourceforge and check the code and resources into SVN, add me as a developer, then I can check out a copy of the code and get to work. Of course I don’t want to get in the way of the next version, so perhaps you should get the final changes for it done, release it, then we can get to work. Sound good?

P.S. I know what you mean about studing various languages. I’ve done my duty in z80 assembly, Basic, C, C++, Java, Javascript, Scheme, and dabbed very breifly with Perl. Ruby looks far prettier then Perl IMHO.

Have your say...

You must be signed in to post the comments.

DISCLAIMER: Any posts on LJ are posted by individuals acting in their own right and do not necessarily reflect the views of LJ. LJ will not be held liable for the actions of any user.

Latest Projects | Latest Blog Entries | Latest Forum Topics