I can find several tutorials on how to render stl files to something that looks like thingiverse renderings but I can't seem to get anything to work on a windows machine. Anyone know how I can do this?
Well someone obviously doesn't like the question but I am sure others have had the problem so here is how I solved it.
I created a web page that rendered the image using jsc3d
<html>
<header>
<link rel="stylesheet" href="/web_inc/all.css">
<script type="text/JavaScript" src="/web_inc/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="/web_inc/jquery.form.min.js"></script>
<link rel="stylesheet" href="/web_inc/bootstrap.min.css">
<link rel="stylesheet" href="/web_inc/bootstrap-theme.min.css">
<script type="text/javascript" src="/web_inc/bootstrap.min.js"></script>
<script type="text/javascript" src="/web_inc/jsc3d.js"></script>
<script type="text/javascript" src="/web_inc/jsc3d.console.js"></script>
<script type="text/javascript" src="/web_inc/jsc3d.webgl.js"></script>
<script type="text/javascript" src="/web_inc/jsc3d.touch.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var canvas = document.getElementById('cv');
canvas.width=1200;
canvas.height=900;
var viewer = new JSC3D.Viewer(canvas);
viewer.setParameter('SceneUrl', '/model/1.stl');
viewer.setParameter('InitRotationX', 0);
viewer.setParameter('InitRotationY', 30);
viewer.setParameter('InitRotationZ', 0);
viewer.setParameter('ModelColor', '#57524C');
viewer.setParameter('BackgroundColor1', '#FFFFFF');
viewer.setParameter('BackgroundColor2', '#999999');
viewer.setParameter('RenderMode', 'flat');
viewer.setParameter('MipMapping', 'on');
viewer.setParameter('Renderer', 'webgl');
viewer.setParameter('Definition', 'high');
viewer.init();
viewer.update();
});
function savePreview() {
var canvas = document.getElementById("cv");
$("#imageData").val(canvas.toDataURL("image/png"));
$("#uploadForm").ajaxSubmit({url: '/ajax_update_sim.php', type: 'post'});
}
</script>
</header>
<body>
<canvas id="cv" class="viewerCanvas"></canvas>
<form action="/ajax_upload_sim.php" method="post" enctype="multipart/form-data" id="uploadForm">
<input type="hidden" name="id" value="1">
<input type="hidden" name="data" id="imageData">
</form>
<input type="button" class="button" value="Save Preview" onclick="savePreview();"/>
</body>
</html>
I then created a php file to save the results
$src="img/1.png"
file_put_contents($src, base64_decode(explode(",", $_REQUEST['data'])[1]));
Related
I would like to combine the two JavaScript libraries/frameworks/scripts scriptaculous.js and validationEngine.jquery but I don’t have a clue how to do it.
My code is like this:
<head>
...
// auto complete
<script src="prototype.js" type="text/javascript"></script>
<script src="scriptaculous.js" type="text/javascript"></script>
// validation
<script type="text/javascript" src="query-1.9.1.js"></script>
<script type="text/javascript" src="jquery.validationEngine.js"></script>
<script type="text/javascript" src="jquery.validationEngine-de.js"></script>
// auto complete
<script type="text/javascript">
Event.observe(window, 'load', function() {
new Ajax.Autocompleter('architect', 'suggestion', ‚'ArchitectQuery.php', {minChars: 3});
});
</script>
// validation
<script type="text/javascript">
$(document).ready(function(){
$("#form-validation").validationEngine();
});
</script>
...
</head>
<body>
...
<input type="text" name="architect" size="45" maxlength="100" id="architect" data-validation-engine="validate[required, minSize[3]]" />
<div id="suggestion"></div>
...
</body>
I guess I have to somehow add the ‚Event.observe‘ part to the validationEngine - but how?
Thanks
Kashuda
First of all, you have to use $.noConflict();, because prototypejs use also $.
<script type="text/javascript">
$.noConflict();
jQuery( document ).ready(function( $ ) {
$("#form-validation").validationEngine();
});
Domus71
I am trying to add a zoom on my image with the jQuery (brilliant) plugin gzoom (http://lab.gianiaz.com/jquery/gzoom/ or http://www.chouselive.co.za/demo/pictures/zoom/gzoom.php).
But it doesn't work. My image is just resized, but there is no zoom in it.
Here is my code :
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test gzoom</title>
<link rel="stylesheet" href="css/jquery-ui-1.7.1.custom.css" type="text/css" media="screen">
<link rel="stylesheet" href="css/jquery.gzoom.css" type="text/css" media="screen">
<style>
div#zoom{
cursor: crosshair;
}
</style>
</head>
<body>
<div id="gzoomwrap">
<div id="zoom" class="zoom minizoompan">
<span class="loader">loading...</span>
<img src='img/myImage.png'/>
</div>
<!-- START gzoom zoom bar -->
<div class="ui-icon ui-icon-circle-minus gzoombutton"> </div>
<div class="gzoomSlider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all" style="width: 258px;"></div>
<div class="ui-icon ui-icon-circle-plus gzoombutton"> </div>
<br style="clear:both">
<!-- END gzoom zoom bar -->
</div>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<!-- START gzoom dependencies -->
<script type="text/javascript" src="js/ui.core.min.js"></script>
<script type="text/javascript" src="js/ui.slider.min.js"></script>
<script type="text/javascript" src="js/jquery.gzoom.js"></script>
<script type="text/javascript" src="js/jquery.mousewheel.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
$(function() {
$zoom = $("#zoom").gzoom({
sW: 300,
sH: 225,
lW: 1400,
lH: 1050,
lighbox : false
});
});
/*]]>*/
</script>
<!-- END gzoom dependencies -->
</body>
</html>
I looked on the Chrome console, and found some errors in the libraries. So I assume I didn't implement gzoom correctly. (Doesn't work in all browsers)
If you know what I'm doing wrong... I'll thank you a lot !
I'm the gzoom plugin author.
The plugin was developed a lot of time ago, but it's still working with new versions of jquery and jquery ui.
If you include a modern jquery version you have also to include a modern version of jquery-ui.
I've just tried the plugin with this versions and it does his job:
jquery-1.10.2.min.js
jquery-ui-1.10.3.custom.min.js
Include this files, and remove the ui.core.min from, and ui.slider.min.
I tried a simple datepicker in my codeigniter page but somehow it's not showing datepicker.
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css" />
<script type="text/javascript">
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
my html code is,
<input type="text" placeholder="Pickup Date" id="datepicker" name="datepicker" class="formfield_text hasDatepicker">
Try this as your html code,
<input type="text" placeholder="Pickup Date" id="datepicker" name="datepicker" class="formfield_text">
This works. The problem is that you can not use class hasDatepicker. Remove it and try.
I want to use Agile Uploader to resize images before upload on my server.
But when I try to upload image on server it does nothing... I mean that there is no image in POST data. I've checked POST and there is no items at all. What am I doing wrong?
Here is my code:
<html>
<head>
<script type="text/javascript" src="/static/js/jquery1.6.4.min.js"></script>
<script src="/static/js/jquery.flash.min.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="/static/css/unrelated.css" />
<script src="/static/js/agile-uploader-3.0.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="/static/css/agile-uploader.css" />
</head>
<body>
<form action="/test" method="post" id="singularDemo" enctype="multipart/form-data">
<div id="single"></div>
</form>
Submit
<script type="text/javascript">
$('#single').agileUploaderSingle({
formId:'singularDemo',
progressBarColor:'#3b5998',
flashVars:{
firebug:true,
form_action:'/test',
}
});
</script>
</body>
</html>
Most code part taken from their demo.
Thanks in advance!
you have to edit the process.php file, where you'll define the remote upload folder!
and then modify the form_action in: "form_action: process.php"
I am pretty new and got a following problem...
case:
We got an accordion and within this accordion we got an sexy-combo-box
<html>
<head>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/lib/jquery.sexy-combo-2.1.2.min.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/examples/usage.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/jquery.autogrow.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/lib/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/lib/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/development-bundle/ui/ui.core.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/development-bundle/ui/ui.accordion.js"></script>
<link rel="stylesheet" type="text/css" href="../../../../Library/WebServer/Documents/sexy-combo/lib/sexy-combo.css" />
<link rel="stylesheet" type="text/css" href="../../../../Library/WebServer/Documents/sexy-combo/skins/sexy/sexy.css" />
<script type="text/javascript">
$(document).ready(function(){
$("#accordion").accordion();
$("#basic-combo").sexyCombo();
});
</script>
</head>
<body style="font-size:62.5%;">
<div id="accordion">
<h3>Form A</h3>
<div>
<p>Please fill out the following:</p>
<p>1. What cookies do you like?</p>
<p><select id="basic-combo" name="resObj" size="2">
<option>jelly</option>
<option>biscuit</option>
<option>chocolate</option>
</select>
</p>
<p>2. What ice cream do you like?</p>
<p><select id="empty-combo" name="sort" size="2">
<option>strawberry</option>
<option>chocolate</option>
<option>vanilla</option>
</select></p>
<p>3. please tell us, how did you get attention to this site?</p>
<p>
<textarea style="width: 400px; height: 84px; min-height: 80px;" class="expanding" name="myTextarea"></textarea>
</p>
</div>
<h3>Form B</h3>
<div>
<p>4. Please tell us the minimum and max amount of chocolate that you eat:</p>
<p>min
<input name="minConsump" type="text" id="start" size="5" />
max
<input name="maxConsump" type="text" id="finish" size="5" />
required time (in minutes) that you take to eat the amount
<input name="reqTime" type="text" id="time" size="5" />
</p>
</div>
</body>
</html>
problem:
- accordion works fine, but sexy combo does not, you can just see the "normal" selection-box
already tried/strange phenomenon:
- removing $("#accordion").accordion(); causes that sexy combo works
possible reason:
- accordion starts before the sexy combo object ...after all the sexy combo object is not being loaded or some sort of "hidden" by the accordion object
does someone has an idea what the reason for this behavior could be ? or how to fix it ?
After reading some topics here I found smth. out like a jQuery live plugin, and that maybe I do need this plugin in order to handle it that when accordion is loaded, the sexy-combo plugin loads too.
best regards
leejin
I found a similar problem when using the sexyCombo in a dialog, so it would be worth checking whether the same problem exists when using it with an accordion.
After examining the markup I realised that the height of the list was being set to 0 when the combo was rendered in the dialog.
I added a dirty hack to my local copy of sexyCombo. Check out line 194 (ish) of the Javascript:
this.singleItemHeight = this.listItems.outerHeight();
For some reason outerHeight() returns 0, so I just added a check to see if singleItemHeight was 0 and if so set it to a sensible value.