Yeah, I figured that. I had to ask, since I remember you did do so before(the link) and I thought somehow Sketchup now could render shaded mode in Tools drawing methods
Nevertheless, It's even more impressive doing it the way you do now..
Yeah, I figured that. I had to ask, since I remember you did do so before(the link) and I thought somehow Sketchup now could render shaded mode in Tools drawing methods
Nevertheless, It's even more impressive doing it the way you do now..
Sweetness!
Are you using your "drawcache" class and hiding the original, or is the original geometry altered back and forth?
I fiddled a bit with this, but it activates the shiftkey after shift+c. Maybe it can be improved... Paste in ruby code editor or such. Only tried in Windows..
BTW I think it might be better to use onkeyup then onKeyDown since it fires so often..
Also combinations might be harder to track..
@dlg = UI;;WebDialog.new()
@dlg.set_size(400,200)
RUBY_PLATFORM =~ /(darwin)/ ? @dlg.show_modal() ; @dlg.show()
def html()
html = %Q(
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="charset=UTF-8" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<style>
body { background-color;grey;}
h1 { color;white; }
</style>
</head>
<body>
<h1>Press shift,ctrl, shift+c or other</h1>
<script>
function sendtoRuby(ki) {
window.location.href = 'skp;keyspressed@'+ki;
}
window.onkeyup=function(e) {
var kc = e.keyCode;
if( kc === 16 &&! e.shiftKey ) {
return sendtoRuby("shift");
} else if( kc === 17 &&! e.ctrltKey ) {
return sendtoRuby("ctrl");
} else if( e.shiftKey && kc === 67 ) {
return sendtoRuby("shift+c")
} else {
return sendtoRuby(kc);
}
}
</script>
</body>
</html>
)
html
end
def testkey(pressed)
puts pressed
end
@dlg.add_action_callback("keyspressed") {|d,params|
testkey(params)
}
@dlg.set_html(html)
Javascript keypress event works for me.. You would have the reversed problem when dialog does not have focus though. But that might be OK.
I suppose one could wrap some keypressevents in a tool class and send it to the dialog, but havent tried that.
Often one can "rethink" these more advanced events and replace them with a simple Icons/buttons.
It would make more sense to click on dialog (to get it's focus) for clicking an button, then clicking on the dialog and then press shift + c (or whatever).
Kaas.
I'm still on ver 8 to poor at the moment. Maybe that's the problem.
@unknownuser said:
It involves some repetitive manual work which would be nice if it could be avoided.
Yeah, I know. Especially if one have to redo it again..
This Skalp plugin looks truly amazing though. Being able to load in CAD patterns will be a killer.
Hi. No it's not me Thanks for remembering though.
I'm working on another project so this one is on hold.
You can use 2dboolean to hatch faces if you have premade edgepatterns-components, you know.
However there is one issue that bothers me, and it is the workflow with Layout.
I recently did a building permit for a house with edge-patterns as roof-tiles.
In SU all was fine and snappy, but updatetime in Layout was unworkable.
I'm sure there are workarounds, but I have my doubts...
I'm still on SU8, so this could be a totally different matter in 2014.
This Skalp-plugin is breaking gravity if it delivers what promised. I wonder how it communicates with Layout ? Is this a Trimble production or individual development ?
@unknownuser said:
ctx.drawImage
Doh! It's a HTML Canvas function call.. I prefer SVG
Anyway. Spits out an error at initialization..
Edit: I can't dig through all your code, but could it be that the "imgresource" needed for the drawImage functioncall is somehow not getting through ?
The dialog is showing up fine without any errors. But when applying a Texture onto a face(any texture from materials palette) and reentering the dialog the JS error occours and persists. No texture is shown on the canvas.
Hi. Get an "undefined" JavaScript error on line 636.
I see in the JS code "ctx.drawImage" is being called. BUT I can't see it has been assigned anywhere..
is the body ready ? Try with a button..
html = <<-HTML
<!DOCTYPE html>
<html>
<body>
<input type='button' onclick='alert(document.body.innerText=navigator.userAgent);'>
</body>
</html>
HTML
dlg = UI;;WebDialog.new()
dlg.set_html(html)
dlg.show_modal
I could think of 2 things related to those errors. You are referencing face.normal in the add instance method. BUT using pushpull on the face after referencing to a variable may delete the original face/faceID or reference what you may call it.
Also maybe using load definitions from paths might bring more succes than add ?
You should never use global varibles. They can mess up other peoples code.
It's not just a matter of personal preference. Your plugin would most likely be banned if using it.
There are several solutions for solving communication between classes, I can think of.
Not sure which one will suit you best for your project or is considered "best practice".
But you could for ex call other classes/modules through getter or setter methods with arguments from within your toolclass. I suspect at launch, you will activate a tool that collects the data from mouse movements with inference and at mouseup or similar you call a method outside this tools class for your shapes. Something like Cube::draw(args).
CONSTANTS are reachable within a class. So you could store a hash like this. DATABASE={}.
Neatly namespaced in your module off course..
There are plenty of Tools/plugins to have a peak in. Be sure to look for plugins that use the toolclass.
For ex camera Tools has some view.draw examples for displaying transient Open GL geometry to aid user feedback/or display transient geometry before drawing the actuall geometry in Sketchup..
http://sketchucation.com/forums/viewtopic.php?t=43290
Just some ideas. Not a real answer. The question is quite broad..
Hi.
I don't know if something has changed in Sketchup 2014 regarding iconsize behavior, but for what I know it looks like you have same pathname for small_icon and large Icon.
cmd.small_icon = File.join("mx_constructtools","addendpoints_icon.png")
cmd.large_icon = File.join("mx_constructtools","addendpoints_icon.png")
Normally you provide different pathnames & different sized Icons(16px and 24px), as Guanjin has provided.
something like:
cmd.small_icon = File.join("mx_constructtools","addendpoints_icon16.png")
cmd.large_icon = File.join("mx_constructtools","addendpoints_icon24.png")
Are the grids 2d ? (it's kinda hard to see). If so you could create the roof first.
Then use a 2d Component. Place it as desired (on each face of the roof) and "2dboolean" will remove anything outside the face in question.
This topic should be made sticky and simply called "Upgrading plugins to Ruby 2.0", in my opinion.
Ha! Awesome, Aerilius. Your almost there!
The latency coming from webdialog freeze while Ruby updates ?
No that can't be it..
Ah like ZAppLink for Zbrush ?
http://docs.pixologic.com/user-guide/zbrush-plugins/zapplink/
Hi. Yes there seams to be Typerror during load.
Ruby console spits this out. Next time I launch dialog opens, and no error message.
Error; #<TypeError; can't convert Symbol into String>
C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/ae_Console/Console.rb;297;in `join'
C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/ae_Console/Console.rb;297;in `initialize'
C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/ae_Console/Console.rb;297;in `map'
C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/ae_Console/Console.rb;297;in `initialize'
C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/ae_Console/Console.rb;295;in `each'
C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/ae_Console/Console.rb;295;in `initialize'
C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/ae_Console/Console.rb;90;in `new'
C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/ae_Console/Console.rb;90;in `open'
C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/ae_Console/Console.rb;578
Thank you Aerilius. This one will be used a lot! Very useful.
I also got that JS error at first launch. Did not hinder me to use the dialog though, so it was surpressed.
This morning I did not get that error.
Another thing, I have to launch the plugin twice to get dialog showing. Persistantly. Tried relaunching SU 3 times, all the same. Not a big deal, but someone impatient might Think the plugin doesent work.
Ah, yeah! Youre right off course. I was thinking of a sectioncut, when it's a sectionplane were dealing with, Doh! Should read the topics better hereafter..
Thanks for the lesson. I Think the TO should manage now.