On lugnet, it's possible ot insert specific parts in posts with the help of a specific code.

It's very handy, while here it's quite a challenge to insert a part image, and with its full name, id and link to the part it's even more cumbersome. Not to mention the source becomes completely unreadable.

Could we have a similar feature here? At the very least, picking a part and its color, the rest may not be as useful.

share
4  
We might have to ask LDraw to use their part images, but I'd definitely appreciate this. If SE keeps a canonical parts image collection, that would also hopefully cut down on the number of times someone uploads a basic 2x4 red brick image. –  user23 Oct 30 '11 at 21:30
    
The question this raises really is: How easy is it to get some custom script/markdown added for this site? For example adding something like: [part:3700] which results in an image of a Technic 1x2 with hole would be great, but quite specialist - do any of the other SE sites do something similar? –  Zhaph - Ben Duguid Nov 1 '11 at 11:50
    
I see that mathematics.stackexchange.com has some custom JS in the form of MathJax.js added to it for formatting equations, so it's not out of the question I assume: math.stackexchange.com/questions/77655 –  Zhaph - Ben Duguid Nov 1 '11 at 11:57
2  
LDraw licensing is here: ldraw.org/Article227.html which seems to imply either: Use with attribution, or render your own images. –  Zhaph - Ben Duguid Nov 1 '11 at 14:25
2  
Which actually begs the question: is it OK to use LDraw images, or BrickLink ones, on this site? Especially considering our own license? –  Joubarc Nov 1 '11 at 18:47
    
@Joubarc Not sure - there's the whole option of "derivative works", if we generate our own images using the LDraw part files I think we're ok, alternatively someone should ask them nicely... –  Zhaph - Ben Duguid Nov 4 '11 at 10:31
    
The ldraw parts library license is CC-BY, which means we're good to go in that regard. –  mattdm Nov 9 '11 at 22:19
    
@mattdm not sure this covers prerendered pictures though –  Joubarc Nov 10 '11 at 4:54
    
As I noted in chat, I also found the following statement on: guide.lugnet.com/partsref/colors "Note: These images are presented here for anyone to reference as needed. You may link directly to these parts images from an off-site web page. To repeat: Yes, it's O.K. to link directly to these images from your website." –  Zhaph - Ben Duguid Nov 11 '11 at 8:50
    
Right, now that you mention it, I remember the "Yes, it's O.K." part. Unfortunately, I don't think their bandwidth is that great. –  Joubarc Nov 11 '11 at 9:31
    
@Joubarc I'm about half way through an initial POC site based on Kevin Carthcart's JS fiddle and polling lugnet once for images and caching data around them, returning it all in one hit to the client... –  Zhaph - Ben Duguid Nov 11 '11 at 13:43
add comment

2 Answers 2

While uploading and converting a stream of LDraw mark-up might be nice, it’s certainly not all that intuitive (for me at any rate), whereas writing something like [part:3700] and having it converted via some script into an image call for that part part:3700 would be a great first step - and would then tie in with the way we can link to tags (for example [tag:feature-request] is replaced with ).

Any more advanced building images could then be manually created and uploaded by the answerer, allowing finer control over the camera position, layout and finish.

LUGNet offers their images up for use - however their servers can be a little slow and we’re hoping to grow quite large, so using their bandwidth might not be great:

Note: These images are presented here for anyone to reference as needed. You may link directly to these parts images from an off-site web page. To repeat: Yes, it's O.K. to link directly to these images from your website.

What Have I Done?

To that end, Kevin Cathcart and I have put together a script and web service that could be used to replace [part:32181c02:0] with a nice picture of a piston ([part:32181c02:0]) – details of this work, and some examples of it in action can be seen here:
http://brickjax.doodle.co.uk/
The web service builds up an internal database of parts as they are called, I’ve pre-populated all the supported colours, however at the moment it doesn’t auto-populate the part names, but I’ve got some plans for that.

The script now also replaces set ids with links to various sites, based on this question.

If anyone has any more advice or feature requests do let us know in chat, or post a question here on meta.

What Can You Do To Help?

I would be very grateful if people could test out the GreaseMonkey/UserScript I’ve built (at the suggestion of nhinkle) and provide any feedback you have as this will help my case when talking to the SE Devs about getting this script formally added to the site.

Install/Update BrickJax UserScript | Source – updated 05/01/12

Currently it only runs once on page load, so live/AJAX updates aren’t supported.

It's also posted to StackApps:

BrickJax: Brick Image Replacement for bricks.stackexchange.com

How Can I Use It?

The scripts current support the following mark-up – if the versions at the end are replaced with images or links, then everything’s working as it should.

  • [part:3700:4]
    Draw a part (Technic Brick 1 x 2 with Hole) in a colour (red) [part:3700:4].
  • [partlink:3700:4]
    Draw a part (Technic Brick 1 x 2 with Hole) in a colour (red) and link to it on Peeron.com [partlink:3700:4].
  • [set:5590]
    Link to set 5590 on Peeron: [set:5590].
  • [bl:5590]
    Link to set 5590 on BrickLink: [bl:5590].
  • [bs:5590]
    Link to set 5590 on BrickSet: [bs:5590].
share
1  
The first step to getting that accepted to to write some proof of concept javascript code, and publish it. The proof of concept need not have all parts availble, but have several different ones, and host them someplace. Once we have working code, then we can discuss whose images to use. Hosting may be problematic, since imgur does not AFAIK support user chosen filenames, and I'm not sure Jeff Atwood and friends really want to put that much on sstatic, but until we have a working poof of concept, that is all moot. –  Kevin Cathcart Nov 4 '11 at 17:50
    
@KevinCathcart You mean something like this? My jQuery's not that great, so there's probably a more performant way of search/replacing for the string - doodle.co.uk/UserFiles/files/code-to-insert-parts.html –  Zhaph - Ben Duguid Nov 7 '11 at 17:59
    
Much like that. The copy I've half implemented is very similar. Like yours, my proof of concept code also rips straight from lugnet. Mine uses a slightly more correct regex. Part numbers can contain letters (to include the pattern codes), you really only want a maximum of one second colon, etc. Mine in based loosely on the rules used by MathJax for deciding where look for text to replace. Things you got right that I missed include the alt text, and making the regex case insensitive. When I get home, I'll upload what I have so far someplace public. –  Kevin Cathcart Nov 7 '11 at 18:36
    
@KevinCathcart Sounds good - I'd not considered patterns, so that's good to know - to be honest I'd have said the colours were an optional extra, generating one set of images would be work enough without generating them in 50+ colours ;) Looking forward to seeing yours. –  Zhaph - Ben Duguid Nov 7 '11 at 21:42
    
Let's continue in chat –  Kevin Cathcart Nov 8 '11 at 3:47
    
You may want to post this on stackapps if you haven't yet. Neat tool! –  nhinkle Dec 17 '11 at 3:36
    
@nhinkle Possibly - I think here or Meta.so should be sufficient, however as a Mod I have other ways of getting in touch with the devs to work it in too ;) –  Zhaph - Ben Duguid Dec 17 '11 at 10:10
1  
@Zhaph-BenDuguid I'm suggesting that you release it as a userscript for now - stackapps is the official way to do that, as it's the central place for all userscripts and apps related to SE. I'm a mod on another site, I know there are other ways to contact them, but this would be a good way to let your users test it out in the meantime until it gets official support. –  nhinkle Dec 17 '11 at 10:39
add comment

A simple way to insert individual parts in a post would be very helpful.

I might argue for something a bit more general. Essentially, allow markup that wraps a LDRAW-compatible text, generally like this:

<ldr>
1 1 24 -6 0 0 -1 0 -1 0 0 0 0 -1 3005.dat
1 1 48 -6 0 0 -1 0 -1 0 0 0 0 -1 3005.dat
</ldr>

Then display a basic render of it. Maybe have it link to the raw text.

ldview can render reasonably quickly and with reasonable visual output, and the results would be straight-forward to cache. (I'm using this approach for my own endeavor.)

Being able to post a model with source like that would open up a lot of interesting possibilities. Answering questions about how to solve a particular set of space constraints for instance, could be initiated with a model illustrating the constraints, and answerers could start from that model and propose solutions.

share
    
I wouldn't mind to see full LDraw code insertion, when illustrating Techniques it would be very useful. Animated GIFs with one image per LDraw step would be even nicer. –  Joubarc Nov 3 '11 at 5:32
2  
The more we ask for (and the more expensive it is on the server) the less chance we'll get it. –  user23 Nov 3 '11 at 10:01
1  
bricks.stackexchange.com/questions/627 has a number of answers that include multiple model suggestions. This is a prime example of where having the ldraw code embedded in the answer would be beneficial... others can learn and build on what has been done here with less duplicated effort. –  retracile Nov 11 '11 at 15:36
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .