💡 LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering Download Trial
  • What does it take to write a commertial plugin?

    3
    0 Votes
    3 Posts
    951 Views
    A

    Alright, thank you! I assume it's all legal unless I'm planning to write a new softwate/app.

  • Component that can not be made unique

    4
    0 Votes
    4 Posts
    763 Views
    S

    If you want each copy to be unique, why not use Groups? The Group#copy method automatically clones the associated ComponentDefinition and hooks the new copy to the new clone. That is, each copy is "unique" right from the start.

  • Right and Left Handedness

    6
    0 Votes
    6 Posts
    995 Views
    TIGT

    The pushpull direction is still important.
    As you will always be going to push the face down, then all you need to do is to make all of your faces look upwards.
    Rather than worry about the loop ccw/cw-ness [which will fail at z=0 as a ccw face will swap to look downwards anyway !] - instead just add the flat face [its loop-direct unimportant], then face.reverse! if face.normal==Z_AXIS.reverse
    Again you need to do a -ve pushpull, so that the top face [now always looking upwards' is retained as the form extrudes downwards...
    You seem to be making this more convoluted than it needs to be...

  • Adding edges to manual selection following a snake pattern.

    2
    0 Votes
    2 Posts
    764 Views
    Dan RathbunD

    phpBB engined forums uses BBcode.
    Please wrap program code in code tags like:

    [pre:3asokg6p][ code ]

    code here

    [ /code ][/pre:3asokg6p]There is a "code" button on the post edit toolbar (2nd row, 3rd button)

    Read help on BBcode: http://sketchucation.com/forums/faq.php?mode=bbcode

  • Are Swig generated Ruby bindings compatible with Sketchup?

    13
    0 Votes
    13 Posts
    3k Views
    D

    @metasim said:

    Success!
    [...]

    I hope someone else finds this useful. I'm glad I don't have to resort to a client/server type implementation and associated headaches.
    Simeon

    Hello,

    I've taken the time to register in SketchEducation just to be able to thank you for this excellent tip. Thanks to you I've been able to succeed after many headaches with my .bundle Swig/CMake generated Ruby/Sketchup extension files causing segfaults every time I used "require" to load them.

    Linking against the Sketchup 2016 embedded Ruby library solved the problems and now I can use the extension!!

    It was extremely useful. Thank you very much! 😄

  • View.write_image shows dotted line border

    13
    0 Votes
    13 Posts
    2k Views
    C

    This is a cross post from our SketchUp Forum post

    tl;dr - In addition to trying the work-arounds in this thread (only the resolution magic numbers worked) we discovered that turning off anti-aliasing eliminates the issue for any resolution - if you can accept the jaggies.

    Hope that helps someone diagnose and fix the issue, or is a workaround for someone until the fix.

  • Material Attributes

    14
    0 Votes
    14 Posts
    2k Views
    Dan RathbunD

    @avariant said:

    Ok. Has this been reported to SU as an official "bug"? It would be very nice to get it fixed some day.

    for SketchUp 2017

    @unknownuser said:

    (https://help.sketchup.com/en/article/141303)":2kct16r6]
    Fixes/Improvements General

    SketchUp API Release Notes

    (Mac) Fixed issue where SKM files lost attribute dictionaries when saved from ‘In Model’ to local library.
  • Tool.onCancel - Reselect tool?

    9
    0 Votes
    9 Posts
    1k Views
    fredo6F

    @eneroth3 said:

    This seems like a documentation error. However when re-selecting a tool the deactivate and activate methods seems to be called right after each other so maybe comparing a timestamp can be used to detect when a tool is re-activated.

    That's what I do, including for simulating a double-click on icon.
    However, you cannot avoid the calls to activate() and deactivate(), just shortcut them.

    I just realize that, should Trimble fix this issue, there could be some regression in my scripts, because I only test status 0.

    Fredo

  • Draw vs. Import Component

    3
    0 Votes
    3 Posts
    868 Views
    TIGT

    You could have the three parts assembled into another SKP in your folder and then load that - bringing in the assembly and the three parts.
    However, if you want to add a new component into the model then use something like:

    model = Sketchup.active_model ### set up names of parts bolt = "MyBolt" washer = "MyWasher" nut = "MyNut" ### here I'm assuming they are already loaded [OR add then now]... ### get a reference to each from the name... defn_bolt = model.definitions[bolt] defn_washer = model.definitions[washer] defn_nut = model.definitions[nut] ### now combine them - add new empty definition name = "MyAssembly" path = Filejoin(path_to_folder, name+".skp") defn = model.definitions.add(path) name = defn.name ### in case name is preexisting, and it's now "MyAssembly#1" ### establish a suitable transformation of each component part - here I'll just call it 'tr_bolt' etc ### because the tr is within the definition's entities, center parts on the ORIGIN ### and move the nut/washer along the Z as needed ### a good idea would be to have the component parts with their insertion points ### at their ORIGINS and the bolt shaft facing down in the Z etc ? defn.entities.add_instance(defn_bolt, tr_bolt) defn.entities.add_instance(defn_washer, tr_washer) defn.entities.add_instance(defn_nut, tr_nut) ### you place the assembly 'defn' the same way, with another suitable transformation... some_entitites_collection.add_instance(defn, tr_defn)
  • SketchUp Ruby Scrambler for Windows

    2
    0 Votes
    2 Posts
    2k Views
    TIGT

    The freestanding RB scrambler has been scrapped for the last couple of SketchUp versions.
    It is no longer available.

    You must now register as a developer with Trimble and upload your RBZ [a re-suffixed ZIP file] containing just one 'loader - "xxx.rb" - and one "xxx" subfolder [containing the extension's main code files and other helper files] to here:
    https://extensions.sketchup.com/en/developer_center/extension_signature
    This gives then you the option of leaving everything as RB files, or encrypting any RB files in the "xxx" subfolder [the 'loader' RB is never encrypted].

    There are also 2 options for encrypting.

    RBS is the older format that is known to have been cracked and offers only obfuscation and not full protection of your IP, however it's advantage is that if will work in all SketchUp versions from v8 up to v2017.

    RBE this newer format is more robust and not [yet] hacked. Its disadvantage is that it only works with v2016 and newer versions. If you opt for including both encrypted versions in your RBZ, then the RBS version exposes your IP anyway.

    Depending on the options chosen, after only a few minutes or processing a modified RBZ is then available for you to download and redistribute yourself.

    When submitting your RBZ it will now always ne 'signed'.
    Two special files are added to the RBZ's subfolder - these 'hash' the RBZ's contents. If the two files are removed or changed, OR any of the sensitive files to which they refer are different from the initial submission, then that loading extension will report itself as 'unsigned' etc in the Extension Manager and will not load is the more restricted loading-policies [although most users will stick with 'unrestricted' anyway!]. The 'sensitive' files in RBZ are RB/RBS/RBE/HTM/HTML/JS/CSS.
    Having your own RBZs 'signed' is not as onerous as making a submission to the EWH.

    If your intention is to publish at the EWH then you also need to register separately as a developer there. You then submit your unsigned/unencrypted RBZ to them. It takes considerably longer than the self-certification option. There are also much stricter coding requirements etc and your submission can be rejected for not following their best practice. This is explained more fully on their site...

  • Cloth tool in sketchup?

    16
    0 Votes
    16 Posts
    15k Views
    sicksickisckS

    dream about real stuff in sketchup heheh no

  • Component browser current selection?

    5
    0 Votes
    5 Posts
    985 Views
    M

    Ok - thanks TIG - i tried again over the weekend.
    Unfortunately i can't get it working the way i want. I think the available observers and methods are just not providing the necessary functionality.

    I can intercept the default MoveTool for a component instance contained in the model using a ToolsObserver and let my tool run instead - fine.
    I can spot when an instance was placed using a ModelObserver with onPlaceComponent and let my tool run - fine

    But i can't intercept the placement of a component before an instance was actually added to the model.
    The ToolsObserver fires when i click on a component in the components browser but doesn't provide info on the chosen definition.
    On that first click in the browser the definition is added to the model's definitionlist (only once as i stated before) and a DefinitionsObserver can spot this (once).
    The component now sticks to the mouse pointer and i can hover over the model. There's no change to the model's entities collection yet.
    The instance is placed when i click (a second time) somewhere in the model.
    Now the component instance is added to the model entities collection and at this point an Entities-Observer or Model-Observer (onPlaceComponent) can spot it.
    But this is already too late for visual feedback while placing.

    Nevertheless... keeping on sketch(up)ing 😄

    Michael S.

  • Plug-in idea - Rounded rectangle, Lozenge, etc as in Layout.

    12
    0 Votes
    12 Posts
    2k Views
    Bob JamesB

    @sdmitch said:

    My RoundedCornerRectangle still works.

    Other than the nit-pick of only available for x-y plane - Perfect. Thank you 👍

    EDIT
    Dumb old me: I already had it installed 😳

    rectangle.png

  • Subtraction with Intersect Method

    5
    0 Votes
    5 Posts
    2k Views
    medeekM

    Got it. Thank-you Sdmitch. As always your guidance with the syntax is impeccable. Even after a year I'm still feel like a bull in a china shop

    I'm still a bit of a ways away from a boolean subtraction but at least I have something to work with now.

  • Call for translators

    14
    0 Votes
    14 Posts
    2k Views
    iichiversiiI

    I can help with Mandarin (Chinese), my fiancé is Taiwanese

  • Its time to discuss an important subject: Plugins/Extensions

    18
    0 Votes
    18 Posts
    2k Views
    T

    Here is the bottom line in the .ZIP to .RBZ saga

    My current version of Winrar 5.31 (64-bit) ....failed to faithfully do a proper .zip conversion.

    TIG informed me how one script I sent him was able to be installed while the other was not.
    How is this possible?
    That lead me to investigate what had happens to WinRar, which I have used for .rar .zip and password protect files since the early 2000's

    I attached one of my very old XP HDD's via a none sata to usb connection to my PC. And there it was, an old copy of Winrar 3.71

    I used the old Winrar 3.71 to make a new zip file renamed .zip to .rbz installed the .rbz voila! ... it installs via the dreaded Installation Manager!

    I admit I'm a so learner, this is not the first time I have regretted getting on that bloody upgrade treadmill. I can hardly wait for SU 2018 😞

  • Ruby selection

    2
    0 Votes
    2 Posts
    511 Views
    TIGT

    First we set up some references.
    model = Sketchup.active_model ss = model.selection

    Then depending on how you want to 'start' off your plugin...

    edges = model.active_entities.grep(Sketchup::Edge)
    An array of all edges in the active context***

    OR

    edges = ss.grep(Sketchup::Edge)
    An array of all edges in the current selection.***

    Now resolve the selection:
    ss.clear ss.add(edges)

    ***The 'rep' finds all edges, including those bordering faces.
    So if you want to select just those edges without faces then you can extend the 'grep' code thus
    ... .grep(Sketchup::Edge).find_all{|e| e.faces.length == 0 }
    The array 'edges' then just lists those edges without faces...

  • Making a hole in a group with multiple subgroups

    5
    0 Votes
    5 Posts
    669 Views
    B

    I've found the problem. It was in line "opening = subelement.entities.add_group"
    I created a group inside the group I wanted to subtract.

  • Deleting duplicate components

    8
    0 Votes
    8 Posts
    4k Views
    sdmitchS

    @bjornburgh said:

    Pasting the Script in the Ruby console doesn't work. Is there another way?

    def remove_instances_duplicates defs=Sketchup.active_model.definitions to_delete=[] defs.each do |compo_def| next if compo_def.internal? instances=compo_def.instances instances2=instances instances2.each do |i2| keeping_instance=instances.shift instances.each do |instance| if instance != keeping_instance and instance.transformation.to_a == keeping_instance.transformation.to_a and instance.definition.insertion_point.transform(instance.transformation)==keeping_instance.definition.insertion_point.transform(keeping_instance.transformation) to_delete.push(instance) puts "Erasing duplicate instance of " + instance.definition.name end end end end to_delete.each { |inst| inst.erase! } end

    There was an extra "end" in the code. Removing that should fix the problem.

    After pasting into the Ruby Console, press Enter then type in "remove_instances_duplicates" to execute.

  • Any way to install two copies of SU (same version)?

    17
    0 Votes
    17 Posts
    2k Views
    T

    If you are really serious about running another copy or another version of SU, without it interfering with the registry then you should consider virtualization a version of your SU software.

    https://my.vmware.com/web/vmware/downloads

    Example: I'm currently using SU 2015 as my main workhorse for daily work. Having found out that SU 2016 wont run many of my Ruby scripts. I created a virtual copy of SU 2016, also known as a Portable version, using vmware.

    Warning: this process should not be attempted without a good understanding of Windows and what virtualization is.

    Here is a short description of how I make a portable copy.

    I always have a fresh bootable install of Windoz only, on a new UBS3 HDD I install vmware and SketchUp on 1
    3, With vmware running I make a new Bootable copy of SketchUp

    Now I can run a portable version of SketchUp from my USB3 HDD or move that Portable to any other HDD
    If you are competent in using vmware you can make versions that allow you to add addons scripts to your portable version, this is very important.

    good luck!

Advertisement