Sketchucation Tools 5.0.7 | Licensing improvements and bug fixes Learn More

Alkategóriák

  • No decscription available

    20 Témakörök
    462 Hozzászólások
    HornOxxH
    @pilou said: More appetizing in chocolate! Eggs are good as well - but only very fragile when falling down in SketchyPhysics
  • Upgrading plugins to Ruby 2.0 for SketchUp 2014

    43
    0 Szavazatok
    43 Hozzászólások
    9k Megtekintések
    tt_suT
    Your force encoding example will only work if the input text file (CSV) file is ISO-8859-1. ISO-8859-1 is all 8bit per character. However, if you open a file that is saved with UTF-8 encoding and it contains characters over the ASCII range (127) then there will be multi-byte characters - when you then force ISO-8859-1 encoding and convert that to UTF-8 you will mangle the characters. If you have no idea or control over the input data then I would try to use a try/catch approach of first reading the file in what is more likely for the file to be encoded in. If you get encoding errors thrown which you can catch and try the next likely encoding. You can then fall back to just reading it as binary: if RUBY_VERSION.to_f > 1.8 filemode << ';ASCII-8BIT' end File.open(file_name, filemode) {|file| file.seek(80, IO;;SEEK_SET) face_count = file.read(4).unpack('i')[0] } Look at these errors and see if they might be thrown: Encoding;;CompatibilityError Encoding;;ConverterNotFoundError Encoding;;InvalidByteSequenceError Encoding;;UndefinedConversionError EncodingError If you are not familiar with Unicode and how it's represented in byte data I would recommend reading up on that as well. The reason it has worked for you so far has probably been that you have had ASCII compatible data. UTF-8 is byte compatible with ASCII where it uses only one byte per character - but the moment you go outside the ASCII (US-ASCII to be precise) it get multibyte characters. For your testing purposes I would strongly recommend you test with non-english characters. For good measure make sure you go outside of European languages as well, try Japanese or Chinese for instance which might be four byte per characters.
  • [code] SketchupExtension and rbs rubies

    10
    0 Szavazatok
    10 Hozzászólások
    5k Megtekintések
    Dan RathbunD
    WARNING: This is an OLD topic thread. The SketchupExtension class has been revised (at least) twice since this topic was written.
  • Override the alt-key in a class ??

    3
    0 Szavazatok
    3 Hozzászólások
    388 Megtekintések
    fredo6F
    @artmusicstudio said: is it possible to override the native alt-function (menu-hi-lite) temporarily within a tool This is possible for ALT. You need to return true in the onKeyUp method for the case of key == ALT_MODIFIER_KEY. Actually, returning true seems to prevent bubbling. This is also a way to prevent characters to go to the VCB Fredo
  • How to load all RBS files ?

    8
    0 Szavazatok
    8 Hozzászólások
    3k Megtekintések
    A
    thanks for the answer Pingpink. somebody opened a thread about your Plugin in the Plugins sections of Sketchucation just the other day. Can you please post more info there? http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=58694%26amp;p=534451#p534229
  • [Solved]Full-Screen Sketchup on Mac

    6
    0 Szavazatok
    6 Hozzászólások
    643 Megtekintések
    D
    Oh well, thanks anyway guys
  • SU 2014 Validtiy Check issues

    16
    0 Szavazatok
    16 Hozzászólások
    2k Megtekintések
    T
    @dan rathbun said: I remember that the layer name of 0 was changed from language localized names to "Layer0" for all language editions at some point. (We would think the validity check would fix this, in newer SketchUp versions.) Perhaps unicode characters are causing issues in layer names ? I'm wondering if the following code I'm using might be the cause? layers=model.layers layers.add (@frame) activelayer=model.active_layer=layers[@frame] layer=model.active_layer #code that places stuff on layer frame #goes here #at the end of this routine I reset layer # Reset layer back to default layer [0] layers = model.layers activelayer = model.active_layer=layers[0] layer = model.active_layer
  • Manipulate text label attached to entity

    6
    0 Szavazatok
    6 Hozzászólások
    814 Megtekintések
    A
    Approach with SelectionObserver: See the documentation: http://www.sketchup.com/intl/en/developer/docs/ourdoc/entities#add_text http://www.sketchup.com/intl/en/developer/docs/ourdoc/text component # be a reference to your component instance position = ORIGIN # or any other point in the component coordinate system direction = Geom;;Vector3d.new(0,0,1) component.entities.add_text(position, "The label text", direction) To find the text again, under the assumption the component contains no other texts: in a Selection Observer def onSelectionBulkChange(selection) return unless selection.count == 1 return unless selection.first.is_a?(Sketchup;;ComponentInstance) component = selection.first return unless component.name == "Specific name" text = component.entities.grep(Sketchup;;Text) # Do something with the text end As I understand your request, you just want to display information to the user, but you do not want to modify/edit the model file. I strongly suggest not to use the native selection tool and observers for this, because it would run always when the user uses the native Select Tool (with a different intention in mind), and observers run always if not properly attached and removed. Plugins should use observers as little as possible (in terms of time), namely only when the user explicitely launches the plugin. Approach with a SketchUp Tool: You could write your own tool instead, which allows you to draw your information to the screen, instead of "modeling" text by adding entities to the model. It is also much cleaner because the user can unselect your tool and use the native Select Tool without confusion. See for reference: http://www.sketchup.com/intl/en/developer/docs/ourdoc/tool http://www.sketchup.com/intl/en/developer/docs/ourdoc/view#draw_text http://www.sketchup.com/intl/en/developer/docs/ourdoc/pickhelper#best_picked linetool.rb example Create a class: module Sepultribe module SensorNodeInfoPlugin class SensorNodeInfoTool SPECIFIC_NAME = "Specific Name" def initialize @selection = nil @info = nil end def onLButtonDown(flags, x, y, view) pick_helper = view.pick_helper pick_helper.do_pick(x, y) item = pick_helper.best_picked return unless item.is_a?(Sketchup;;ComponentInstance) return unless item.name == SPECIFIC_NAME # Now you have the right component, store it in an instance variable. @selection = item # Fetch the info that you want to display (assuming you have it stored as attribute) @info = @selection.get_attribute("dictionary_name", "attribute_name", "") end def draw(view) return if @selection.nil? position3d = @selection.transformation.origin # or @selection.bounds.center position2d = view.screen_coords(position3d) # (You could also draw the bounding box of the selected component.) # Draw an arrow. vector = Geom;;Vector3d.new(20,-20,0) view.draw2d(GL_LINES, position2d, position2d+vector) # Draw the info. view.draw_text(position2d+vector, @info) end end # module Sepultribe # Add the plugin to the menu, only once when the file is loaded. unless file_loaded?(__FILE__) command = UI;;Command.new("Display Sensor Node Info"){ Sketchup.active_model.select_tool(SensorNodeInfoTool.new) } UI.menu("Plugins").add_item(command) end end # SensorNodeInfoPlugin end # module Sepultribe
  • Put forward drawings openGL

    14
    0 Szavazatok
    14 Hozzászólások
    1k Megtekintések
    D
    Anton_S your code is very interesting (highlight_picked_body.rb), I have never used Start and stop operation inside a custom tool, I like the result, I am studying this code
  • Color changes with regard to distance from a surface

    3
    0 Szavazatok
    3 Hozzászólások
    378 Megtekintések
    SkeeterdS
    Whew! Thanks a million TT! Had no idea that button was active unless sun/shadows was turned on. Didn't even think to try that. That did it. A simple fix indeed. Digging SU just a little more... I'll post this model to the forum once it's completed. I'd call it the Mother of all SU projects. 18 buildings and all the related parking lots, side walks, grounds, tress etc. Really TT, thanks for the fix!
  • Ruby: 3d align components

    5
    0 Szavazatok
    5 Hozzászólások
    519 Megtekintések
    sdmitchS
    @kaas said: @sdmitch said: If you are willing to post or pm me a sample model and the plugin, I will be glad to see what if anything I can do with it. Hi Sdmitch, thanks for your offer. Jolran and I are already pm-ing about a solution so I think it will be already resolved. Max Great, but the offer is still good.
  • Ruby question: create faces from edges? Faces with holes?

    9
    0 Szavazatok
    9 Hozzászólások
    2k Megtekintések
    tt_suT
    The issue is that edges = entities.add_edges [[30,0,10], [50,0,10], [50,0,30], [30,0,30], [30,0,10]] doesn't weld the start and end point. Therefore there are two vertices at the same 3d point that isn't welded. add_face(edges) require the edges to form a closed loop - the edges you have in this case just looks to be closed. It's unexpected, I agree, but changing the behaviour now might break existing extensions. But any reason for first creating edges and then creating the face from the edges instead of just creating the face with the points directly?
  • Units in the input value through the VCB

    3
    0 Szavazatok
    3 Hozzászólások
    439 Megtekintések
    D
    Dan thanks for replying, I found a recommendation yours here http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=55722%26amp;p=505915%26amp;hilit=units+vcb#p505915 which led me to the article by thomthom http://www.thomthom.net/thoughts/2012/08/dealing-with-units-in-sketchup/ I only have problem for receiving angles values ​​with comma as decimal separator, then I am forced to use the following text_input.sub!(',','.') text_input.to_f.degrees I do not know if there is a better method
  • Issues with Scrambler

    6
    0 Szavazatok
    6 Hozzászólások
    1k Megtekintések
    Dan RathbunD
    Karen.. this is a forehead smacker (so get your hand ready.) Standard Ruby has no idea what a scrambled rbs file is, or how to decrypt it. So the SU development team created a module method that could open, decrypt and then evaluate them. You need to use the Sketchup::require() module method. There are other issues with scrambling. The Ruby keywords __LINE__ and __FILE__ do not currently work inside scrambled rubies. (Fixed in SketchUp 2014+ using Ruby 2.0 or higher.) I'm am glad that you have decided to use your own filespace. It's only smart. I posted an example of doing this with scrambled rubies. See: [ code ] SketchupExtension and rbs rubies
  • Webdlg debugging on Mac using WebKit inspector

    8
    0 Szavazatok
    8 Hozzászólások
    2k Megtekintések
    tt_suT
    Install Visual Studio Express (free). Then you can either attach it to SketchUp's process, or inject debugger; statement in your JS code to make the system prompt you to debug. You can then set breakpoints in Visual Studio and inspect variables and call stacks. I sometimes use a catch-all code like this to trigger the debugger on errors without having to inject debugger; around in the code: window.onerror = function(message, location, linenumber, error) { // Trigger an request to attach debugger. debugger; return false; };
  • HTML5 Canvas in Webdialogs

    3
    0 Szavazatok
    3 Hozzászólások
    484 Megtekintések
    B
    Brilliant! Thank you so much - it's working fine now.
  • Unexpected result (closest_points)

    3
    0 Szavazatok
    3 Hozzászólások
    366 Megtekintések
    D
    sorry for my silly mistake, thanks Sdmitch
  • Selection.add ??? possible?

    4
    0 Szavazatok
    4 Hozzászólások
    449 Megtekintések
    tt_suT
    Was that a question on how? Or did you experience issues with Selection.add (because that is exactly the API method to do what you requested: http://www.sketchup.com/intl/en/developer/docs/ourdoc/selection#add)
  • UI exit ruby?

    4
    0 Szavazatok
    4 Hozzászólások
    769 Megtekintések
    artmusicstudioA
    hi and thanx to both, @ tig: yes, i also use puts-tags to follow the code in the console , whit line-number-output to see, in which code -line the puts is. i will try out all the break, next etc. functions. thanx for this? and @tt_su yes, interaction with the viewport was exactly, what i hoped for, so i could inspect the geometry at any stage ot the running code. (break - inspect geometry - go on....). the rest is still tooooo 'high' for me, although i already 'speak' a bit ruby...-:) stan
  • Read and Write (update) problem

    12
    0 Szavazatok
    12 Hozzászólások
    1k Megtekintések
    S
    Thanks to every one here (and also Thomas Thomassen) the work is now finished! https://www.youtube.com/watch?v=xQOgv2OedJM
  • How do I run send_action for a custom menu item

    4
    0 Szavazatok
    4 Hozzászólások
    616 Megtekintések
    TIGT
    You can't use the script's code if it's inside an encrypted RBS, but if the Extension menu/toolbar-maker is in a RB, then you can read it to see what it's doing... You have to do some detective work... If we knew this 'secret' extension then we could comment more constructively

Advertisement