i tend to do write temp content next to the Sketchup file and in the end just delete it again.
that location should be writable for sure.
Posts made by Pout
-
RE: Should have seen this coming - Where to write temp files?
-
RE: SketchUp/OSX Lion Known Google SketchUp Lion Issues
@pout said:
Just for the devs to know:
in webdialogs when you would use the input type 'file' the path send to Sketchup is replaced by 'C:/fakepath'
Haven't found a solution yet.This has to do with the html 5:
http://acidmartin.wordpress.com/2009/06/09/the-mystery-of-cfakepath-unveiled/For me, a problem, since i use this to import xml files in Sketchup.
-
RE: SketchUp/OSX Lion Known Google SketchUp Lion Issues
Just for the devs to know:
in webdialogs when you would use the input type 'file' the path send to Sketchup is replaced by 'C:/fakepath'
Haven't found a solution yet. -
RE: Webdialog stops working after action_calback
here it goes (it's still a dev)
1.webdialog 1 opened with:
$xdinfowindowke=UI;;WebDialog.new("xDInfo", true,"xDInfo",290,300,0,0,true) fn= $html_folder+"/xD_infowindow.html" $xdinfowindowke.set_file fn $xdinfowindowke.set_size(290,300) $xdinfowindowke.show {}
2.populated from ruby with
//activated each time another SU entity is clicked command = "_sendinfo('#{$sendobjectid}','#{$sendlist}')" $xdinfowindowke.execute_script(command)
3.javascript in webdialog 1
function _sendinfo(theobjectid, theinfo){ //fill in the rows attr=theinfo.split("|||"); for (i=0;i<attr.length;i++){ splitted=attr[i].split("$$$") var oRow = oBody.insertRow(-1); //insert the first cell var oCell = oRow.insertCell(-1); oCell.className="attrnames"; oCell.innerHTML = splitted[0]+";"; //insert the second cell var oCell = oRow.insertCell(-1); oCell.className="attrnames"; //if it is the objectname, make clickable if (i==0){ oCell.innerHTML = "<a href='javascript:_show4Dobject("+theobjectid+")'>"+splitted[1]+"</a>"; } else { //if the string contains ^ it means it is a link. split up if(splitted[1].indexOf("^") != -1){ waw=splitted[1].split("^"); oCell.innerHTML='<a href="'+waw[1]+'" target=_blank">'+waw[0]+'</a>'; } else { oCell.innerHTML = splitted[1]; } } } //add the end attach a last row var oRow = oBody.insertRow(-1); var oCell = oRow.insertCell(-1); oCell.height="1px"; oCell.colSpan="2"; oCell.className="split"; }
- This makes some html links in webdialog1 with this code:
<a href='javascript:_show4Dobject([i]id[/i])'>"[i]name[/i]"</a>
handled by this code in webdialog1:
function _show4Dobject(objectid){ query = 'skp;_show4dobjects@'+objectid; window.location.href = query; }
- Now back in SU this is handled by:
$xdinfowindowke.add_action_callback("_show4dobjects") {|$xdinfowindowke,p| #check if the xdwindow is open--> [b]this is another window[/b] if $xdwindow visible=$xdwindow.visible? if visible==true command = "_xdhighlight('#{p}')" $xdwindow.execute_script(command) else UI.messagebox('Open the 4D Objects window to highlight') end else UI.messagebox('Open the 4D Objects window to highlight') end }
Basically this all goes fine. When the html link is clicked in webdialog1, something happens in webdialog2
But from there on, when i click another SU entity the content of webdialog1 is not updated anymore.
Hope the information here helps.Thx!
-
Webdialog stops working after action_calback
Script structure:
User clicks a button
This sets an selection observer and opens a webdialog1
Each time the user clicks another SU entity the content of the webdialog1 is updated
In webdialog1 are clcikable hyperlinks pointing to a javascript that executes an action callback towards the script again.In that action callback, at ruby side a value in another webdialog is updated.
This all goes well.But from then on (so when the hyperlink is clicked in webdialog1 and the value is updated in webdialog2) the content of webdialog1 does not change anymore when clicking another SU entity.
Somewhere along the line something falls apart. Any ideas?
If wanted i can post a movie of the action.Thx,
Pout -
RE: Observer question
suberb, and this on a sunday!!!
Thx tig and dan, much appreciated! -
Observer question
must me the heat here but some how i'm puzzled.
I want to remove an observer.It's added like this:
Sketchup.active_model.selection.add_observer(MySelectionObserver.new)and here is the observer code:
class MySelectionObserver < Sketchup::SelectionObserver
def onSelectionBulkChange(selection)
#code to execute when the selection changes
end
endNow how do i remove this observer?
Thx!
-
Plugins menu not shown or in different language
2 questions
If you use menu = UI::menu("Plugins");
Will this work in non English versions of SU?In some cases the Plugins menu item is not shown. Is there a way to automatically show it?
Thx!
-
RE: Multi-language plugin
Wouldn't it be a good idea to create a global system for all plugins?
-
RE: Multi-language plugin
ThomThom
I have had a look at the way SU works (with LanguageHandler.new)
I'm still a bit puzzled though on what the best way to do this isDefault LanguageHandler seems to look into Resources/en-US directory for the strings file
So i suppose when a french SU version is installed it will look into Resources/FR (or something simular)This, in short would mean that the user (or the installation procedure) would need to put the correct language file in the correct directory (english language file in en-US, french language file in FR)
Is there an easier way to do this?
Maybe write all the plugin specific language files in a directory and access those? -
RE: Determine OS bit version with ruby
thx TBD and Dan
I need it to determine where certain file are located.
For now i have used a similuar aproach as Dan suggested in which you look if Program Files(x86) 'exists'
But i think his method is better. -
RE: Multi-language plugin
Thx for th information thomthom, i'll have a look
-
Multi-language plugin
I was wondering if there is a built-in possibility so a plugin can be installed in different languages?
Probably somewhere with the resources? I assume the .strings files are translation files? -
Determine OS bit version with ruby
Is there a way to determine wether the OS where Sketchup is installed on is 32 or 64 bit?
puts RUBY_PLATFORM gives me i386-mswin32 (which is probably the ruby version since i am working on 64 bit)machine_bytes = ['foo'].pack('p').size
machine_bits = machine_bytes * 8
Also gives me 32, again probably because ruby/SU is 32 bitIs there another way?
Thx!
-
RE: [Plugin] Proper Animation V1.08 Beta(Updated 14/11/10)
a question:
It seems to be impossible to add non-animation scenes?
If i don't set a position 8 and do set a position 9 then when selecting Scene 9 the position is not taken.
So if I understand correct all positions have to be set?Thx
-
RE: [Plugin] Proper Animation V1.08 Beta(Updated 14/11/10)
Gaieus,
Great movie,
Imagine that combiend with linking to scheduling...
Let's see what I can do -
RE: Instructor content
tried this to before
after some testing i just created a tutorial in a webdialog -
RE: Ruby created images not ok?
Hey Tig,
Thx for the answer.
Why i am not using teh animation exporter is because it skips page observers.
Since changing from one page to another invokes a function in my model i cannot use it.That's why i'm looking for an alternative to create movies.
You think it's possible that adding the compression an transparent factor solves the issue?
Cause i have also tried it with images generated by Export-->2D graphic and that had the same error.Thx!
-
Ruby created images not ok?
i have created a set of images with the code
view.write_image(imagename,width,height,true)Those images i want to convert towards a movie based on command line driven ffmpeg
When i use standard commands the movies are created but only on some machines and some media players they are playable
When i use extended commands eg. specifying the codec no movie is createdApp. the images generated by Sketchup (both jpg and bmp) have damaged headers so the movies are not generated.
Anyone knows if the created images by Sketchup^are completely ok, or are there also problems in other applications/scripts
-
Slice plugin
I know there are some arround like Zorro2.
This is what i need to do:Slice a complete model (all visible elements) based on a plane
The model entities can be groups/single objects etc.
If possible a sliced group must return 2 new groupsWhich one is best to use? Or can I just do this with SU8 solid functions?
Thx!