sketchucation logo sketchucation
    • Login
    1. Home
    2. HPW
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    H
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 29
    • Posts 126
    • Groups 1

    Posts

    Recent Best Controversial
    • Model.save does not save

      The doc here http://groups.google.com/group/SketchUp-Plugins-Dev/web/Ruby-Model.html#save

      @unknownuser said:

      model = SketchUp.active_model
      status = model.save “mysketchup.skp”

      Wouldn't a save need a filename with full path?

      
      model = Sketchup.active_model
      skpdirname = File.dirname(model.path)
      skpbasename = File.basename(model.path, ".skp")
      
      #Here I import a DWG with skpbasename+".dwg"
      
      savename = skpbasename+".skp"
      status = model.save savename
      
      

      It returns 'true' but nothing is saved back to disk.
      So how can I save my SKP from ruby?

      posted in Developers' Forum
      H
      HPW
    • RE: SKM file format

      Doesn't SU understand them all?

      face.material = 255 # This is RGB integer here Blue
      face.material = 16711680 # This is RGB integer here Red
      face.material = 0xff # This is hex Blue
      face.material = "red" # Red by name
      face.material = "#ff0000" # This shows it as a 32 Bit Hex RED
      face.material = "#0000ff" # This shows it as a 32 Bit Hex BLUE

      Edit: Corrected color-names since the low Byte is Blue

      posted in SketchUp Discussions
      H
      HPW
    • RE: SKM file format

      @unknownuser said:

      So the colour information is obviously stored in the big number after the second comma

      Seems to me a RGB Integer where each Byte is a color (Red/Green/Blue).

      http://code.google.com/intl/de/apis/sketchup/docs/ourdoc/color.html

      face.material = 255 # Here you may use the number
      face.material = 0xff
      face.material = "red"
      face.material = "#ff0000" # This shows it as a 32 Bit Hex

      posted in SketchUp Discussions
      H
      HPW
    • Commandline Import DWG

      It would be nice if SU could be started with a DWG as the commandline parameter.

      Now it appears a messagebox: This does not appear to be a Sketchup model!

      It should open and import the DWG as it happens from the menu.

      posted in SketchUp Feature Requests sketchup
      H
      HPW
    • Ruby equivalent for edit/delete guides?

      It there an ruby equivalent for edit/delete guides from menu?

      posted in Developers' Forum
      H
      HPW
    • RE: Fastest way to select component by definition.name

      Hello TIG,

      Again many thanks for the hint.

      sel_def.instances[0].add_entities(MySubCompArray)

      does the job for me.

      Now I can use the imported dummy-block from autocad as the hierarchy-master instead of creating a separate new group. Will keep the outliner structure more readable. I also use now Jim's togglewindows.rb to keep the outliner close during execution.

      posted in Developers' Forum
      H
      HPW
    • RE: [Code] ComponentInstance-add_entities v1.9

      So now we have this great addition to the toolset, what is the best way of delivery?
      The file gets copied into the Plugins-Directory.

      What should our own installer should do?
      Check the existence of the file and install it if not present?
      Check date and install it if a newer version is available?

      Can the ruby-code check if the method is installed?
      If not use a copy installed in the own subfolder?

      posted in Developers' Forum
      H
      HPW
    • RE: Help with hyperlinks

      Adam,

      Thanks for the script.
      I wasn't aware of Sketchup.open_file(url).

      Does it open a new instance or does it replace the open file?

      posted in Developers' Forum
      H
      HPW
    • RE: Help with hyperlinks

      http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=18006&start=0&st=0&sk=t&sd=a

      posted in Developers' Forum
      H
      HPW
    • RE: Fastest way to select component by definition.name

      Hello TIG,

      I tried a different approach with your componentinstance.add_entities
      (Your ComponentInstance-add_entities.rb is loaded)
      (Instead of creating a new Master-Group I want to make a existing component to the master-component of it's Sub-components)

      sel_def = Sketchup.active_model.definitions['MyDefName']
      sel_def.add_entities(MySubCompArray)
      
      

      This throws the error ' undefined method `add_entities' '
      I think I need the instance.
      So what's the way back from the definition to the instance?
      (Still miss the deep understanding of SU data-model) ;-(

      posted in Developers' Forum
      H
      HPW
    • RE: Help with hyperlinks

      For interfacing Win32API your ruby-scripter may have a look at Jim's toggleWindows.rb

      posted in Developers' Forum
      H
      HPW
    • RE: Help with hyperlinks

      @unknownuser said:

      Is it possible to link from SU file to SU file from hyperlinks?

      Link from local file to local file?
      Or link to an url with the file?
      One hyperlink per component?

      Some rough ideas (WIN):

      For an local file the idea is to write a ruby script with a 'require Win32API.so' and import the ShellExecute from shell32.dll .

      The hyperlink could be stored in a DC-attribut:
      sel_def.set_attribute 'dynamic_attributes', 'hyperlink', 'c:....'
      sel_def.set_attribute 'dynamic_attributes', 'hyperlink2', 'c:....'

      A ruby command would read the attribut and fire the ShellExecute.
      Of cource a second instance of sketchup will start.

      For an external URL no idea yet.
      It would need to first download it and then open it in a second instance.

      posted in Developers' Forum
      H
      HPW
    • DC Dictionary storage

      After importing 94 components (some gets glued to 14 groups) from autocad I get a SKP with 564 KB.

      The I import a certain amount of attributs (exported from Lisp-code to ruby-code) into this components to make non-editable-DC from the 94 components and the group-containers.
      I ended with an SKP with 1021 KB.

      Question: Are dictionarys stored in bigger chunks? Or does the attribut storage need this space?

      posted in Dynamic Components sketchup
      H
      HPW
    • Text_Only labels in DC possible?

      Can I have Text_Only labels in DC 'Component Options' window?
      Example: I have 2 input fields with explaining formlabel's.

      Between this 2 rows I want to add a longer explaining text as a pure textlabel without an edit-field.

      Possible?

      If so whats the attribute-format for this?

      Viewed with this:

      Sketchup.active_model.selection[0].definition.attribute_dictionary('dynamic_attributes').each_pair { |k,v| puts k + '; ' + v.to_s }
      
      posted in Dynamic Components sketchup
      H
      HPW
    • RE: Add DC-Attribut to group not show up

      TIG,

      Many thanks again for this tip.
      Since my groups are unique I tried to attach to the group itself.
      And it works!
      By the way: The make_unique throws a warning that it is depreciated.

      One problem pops up.
      The little image in the top left edge of the 'Components Options' window show normaly the component.
      Since the Group itself is no component it shows the last successfull loading image.
      I tried to set:

         group.set_attribute 'dynamic_attributes', 'imageurl', ''
      
      

      but this does not help.
      Not sure if I must point to a real image on the net or can I use a local file-url.

      Hans-Peter

      posted in Developers' Forum
      H
      HPW
    • Add DC-Attribut to group not show up

      I generate groups for my imported autocad-components to restore a hierachy.
      Now I would like to show some info in the 'Components Options' window when group is clicked.

      First I follow TIG's hint and add a definition to the group:

      class Sketchup;;Group
        def definition
          return self.entities[0].parent
        end
      end
      
      

      Then I do:

      ### Creating of the group from array
         group = entities.add_group(@group_list)
      
      ### Try to store attribut in group
      
         group_def = group.definition
         group_def.set_attribute 'dynamic_attributes', '_hasbehaviors', '1.0'
      
         group_def.set_attribute 'dynamic_attributes', '01_dummy', 'Dummy'
         group_def.set_attribute 'dynamic_attributes', '_01_dummy_label', '01_dummy'
         group_def.set_attribute 'dynamic_attributes', '_01_dummy_formlabel', 'This is a dummy attribute'
         group_def.set_attribute 'dynamic_attributes', '_01_dummy_units', 'STRING'
         group_def.set_attribute 'dynamic_attributes', '_01_dummy_access', 'VIEW'
      
         group_def.set_attribute 'dynamic_attributes', 'name', 'MyName'
         group_def.set_attribute 'dynamic_attributes', 'description', 'MyDescription'
         group_def.set_attribute 'dynamic_attributes', 'dialogwidth', '460'
         group_def.set_attribute 'dynamic_attributes', 'dialogheight', '550'
      
      

      The attribute gets stored in the dictionary, but opening the 'Components Options' window show only the default window with group.name and 'There are no options to choose on this component.'

      Maybe it is hardcoded that group can not have DC attributes?

      posted in Developers' Forum
      H
      HPW
    • RE: Ruby console remember size between calls and sessions

      Found it by try_and_error:

        sel_def.set_attribute 'dynamic_attributes', 'dialogwidth', '460'
        sel_def.set_attribute 'dynamic_attributes', 'dialogheight', '900'
      
      
      posted in SketchUp Feature Requests
      H
      HPW
    • RE: Ruby console remember size between calls and sessions

      Chris,

      Can you show the attributes (Dialogwidth and Dialogheight) looks in the dictionary? (I do not have SU 7 Pro yet)

      Using this snippet:

      Sketchup.active_model.selection[0].definition.attribute_dictionary('dynamic_attributes').each_pair { |k,v| puts k + '; ' + v.to_s }
      

      from here:
      http://www.sketchucation.com/forums/scf/viewtopic.php?f=289&t=18275

      posted in SketchUp Feature Requests
      H
      HPW
    • RE: Ruby console remember size between calls and sessions

      Hello Jim,

      Just download your ruby-toolbar and I will give it a try tomorrow.

      Is such added logik also possible for the DC 'Components options' window?

      Hans-Peter

      posted in SketchUp Feature Requests
      H
      HPW
    • Component options remember its size betw. calls and sessions

      It would be nice if the Component options window could remember its size between calls and sessions.
      When I close and reopen it in one session it always gets a default size.
      The same is with separate sessions.

      The position is only remembered between sessions.
      When I move it and reopen it it opens there where stored in the last session.

      posted in SketchUp Feature Requests sketchup
      H
      HPW
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 4 / 7