sketchucation logo sketchucation
    • Login
    1. Home
    2. kat
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 14
    • Groups 1

    kat

    @kat

    10
    Reputation
    1
    Profile views
    14
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    kat Unfollow Follow
    registered-users

    Latest posts made by kat

    • RE: Component layer?

      But ComponentDefinition inherits from Drawingelement and this class has a layer method? I don't understand

      posted in Developers' Forum
      K
      kat
    • Component layer?

      Hello,

      I have a issue about the layername of a component that I really don't understand.

      At the start of my program, new componentdefinitions are loaded from an external folder. Then I attach them to a layer with the following code:

      constructionlayer = $model.layers.add "Construction"
        componentdef.layer = constructionlayer 
        componentdef.entities.each{ |e| e.layer = constructionlayer }  
      

      When the component further is instanced in het model and asked for its layer with the following code snippet, it returns first "Construction" and then "Layer0". So the layer of the ComponentDEFINITION is initialized as "Construction", but the layer of the ComponentINSTANCE isn't.

      selection[0].definition.layer.name
      selection[0].layer.name
      

      When I then save the SU file, open it again and ask an other time for the component's layer with the same piece of code, I get first "Layer0" en secondly "Construction". I assume that the layer of the ComponentDEFINITION is now "Layer0" and the layer of the ComponentINSTANCE is "Construction".

      How is this possible?
      Does anyone know about a workarround for this problem?
      After building the SU model, I make a selection of components based on layername, so it is important that this is correctly set in both situations.

      Thanks a lot for all help!

      posted in Developers' Forum
      K
      kat
    • RE: Command icon

      Yes exactly, that was my question, i didn't understand why i needed to add two different sizes of icons to the Command.
      I think i did everything as explaned in the API docs, but i still won't display the icon. Are there any settings that i should check? Or something like .visible = true?

      posted in Developers' Forum
      K
      kat
    • Command icon

      Hey,
      I 'm working on a toolbar for my script, but the icon that i've asociated with the command won't appear on the button.
      Does anyone see what i'm doing wrong?
      This is my code snippet:

       $plugins = Sketchup.find_support_file "Plugins", "/" 
      result = UI;;Command.new("Print results"){print_info}
      result.status_bar_text = "Print the resultfile"
      result.small_icon = File.join($plugins,"Icons","Result.png")
      toolbar = UI;;Toolbar.new("SuFiQuaD")
      toolbar = toolbar.add_item result
      toolbar.show
      

      Does the image of the icon has to be exactly 16x16 or 24x24 pixels? Can i put the image file in the Plugins folder?
      Why is there a difference between small and large icon?
      thanks a lot for any help.

      posted in Developers' Forum
      K
      kat
    • RE: Resize inputbox

      hmm, i did some Java programming before, but that was a long time ago... ๐Ÿ˜•

      posted in Plugins
      K
      kat
    • RE: Save panel when new SU file

      Thanks, can't see why i didn't think of that...

      posted in Plugins
      K
      kat
    • Save panel when new SU file

      Hey,
      In a script I try to make a new SU file to save in the components folder and draw a text object into. Therefore I first have to know the path of the old SU file in order to be able to open it again after opening, drawing in, saving and closing the new SU component file.
      I do this with an inputpanel so I can save the path the user has chosen, but when I then make a new SU file with

      Sketchup.file_new
      

      Sketchup automatically asks the user to save the current file and opens a second save panel again.

      def make_skp()
      ss = Sketchup.active_model.selection
      skp = Sketchup.active_model.name # Name of the current SU model
      path1 = Sketchup.active_model.path # Path of the current SU model
      
      # Settings of the selected text object
      tekstlabel = ss[0] 
      v = ss[0].vector
      name = ss[0].text
      l = ss[0].leader_type
      a = ss[0].arrow_type
      p = ss[0].point
      tekstlabel.erase! # Delete the text object
      
      UI.messagebox "Please save your SU file."
      path2 = UI.savepanel("Save as",path1,skp)
      # Check if path2 ends with skp
      	p = path2.split(".")
      	if p[1] != "skp"
      		path2=path2+".skp"
      	end
      Sketchup.active_model.close_active # Close the current SU model
      
      su = Sketchup.file_new # Make a new SU file for the text object
      path3= File.join($components, "Opbouw", name+".skp")
      su.active_model.save(path3)
      # Make a new text object with the same settings in the new file
      	t = su.active_model.entities.add_text(name,[0,0,0]) 
      	t.vector = v
      	t.leader_type = l
      	t.arrow_type = a
      	t.display_leader = true
      su.active_model.save(path3) # Save the new SU file
      su.active_model.close_active # Close the new SU file
      
      # Open the old SU file again
      Sketchup.open_file(path2)
      
      end
      

      The code I wrote works perfectly, but does anyone has an idea of how to avoid this second savepanel witch is a little bit annoying to fill in all over again?

      posted in Plugins
      K
      kat
    • Resize inputbox

      Hello,
      I use a SU inputbox in my script with some predefined possibilities for the user.
      for example:

      def dialog3()
      number_layers = 2
      
      prompts3 = Array.new(number_layers) { |i| "Layer "+(i+=1).to_s}
      defaults3 = Array.new(number_layers) { |i| "--Select--"} 
      list3 = [ "WFEX0001;Wall, external finishes - closing sub-element - blocks/stones - natural stone - breuksteen (09 cm)
      |WFEX0002;Wall, external finishes - closing sub-element - blocks/stones - concrete blocks - white (190x90x90)
      |WFEX0003;Wall, external finishes - closing sub-element - blocks/stones - concrete blocks - grey (190x90x90)",
      "THINS0001;Thermal insulation in cavity - blanket, batt - anorganic fiber - rock wool - hard (6 cm)
      |THINS0002;Thermal insulation in cavity - blanket, batt - anorganic fiber - rock wool - hard (10 cm)
      |THINS0003;Thermal insulation in cavity - blanket, batt - anorganic fiber - rock wool - hard (14 cm)"]
      
      d3 = UI.inputbox(prompts3,defaults3, list3, "Layers ")
      end
      

      Because my list contains very long strings, SU automatically produces this ridiculously huge inputbox that won't even fit the screen. Does someone know how to resize it?

      posted in Plugins
      K
      kat
    • RE: Suface scaled component instances

      Hey thanks, this last one was a very good tip.
      I think what AdamB proposed is a very professional approach of the problem.
      I 've tried it out in my code and it works fantastically.
      Yet, it would be interesting to understand WHY this actually works,
      does someone know a bit more about the matematical background of this vector based solution?

      posted in Plugins
      K
      kat
    • RE: Faces area in a group ?

      Hey thanks a lot AdamB for your super professional approach!
      Finally found what I was looking for, now my code works fantasticly.

      I did some additional reading about the Frennet-Serret/TNB frame but I don't really understand everything.
      If I get it wel, the normal(N) is perpendicular to the face, the tangent(T)'touches' the face and de binormal(B) is perpendicular to both normal and tangent. But then how do you know on which side of the face formed by N and T, is B? I don't get the
      @unknownuser said:

      tangent = (normal * binormal)
      multiplication. Isn't B supposed to be the cross product of N and T?
      And why is gives
      @unknownuser said:

      (xform * binormal).length * (xform * tangent).length
      

      you the scale factor?

      Could you give me some extra matematical information about this?
      I would like to understand why this code works,

      thanks, kat

      posted in Developers' Forum
      K
      kat