• C SDK save in 2022 or 2023 formats

    7
    0 Votes
    7 Posts
    35 Views
    G

    @TIG Thank you for your input. My understanding of the C SDK is:

    SUModelSaveToFileWithVersion(model, "SU2021.skp", SUModelVersion_SU2021); - Should save into the "versionless" 2021 format and it should load without any error or warning into SU 2022 and SU 2023

    SUModelSaveToFileWithVersion(model, "SUcurrent.skp", SUModelVersion_Current); - should save in the version of the SDK (in this case 2024)

    But instead both function calls save in SU 2024 format which IMO is an error in the SDK.

    I'll try to contact them to sort this.

  • 0 Votes
    4 Posts
    49 Views
    Dan RathbunD

    If it does not work using onLButtonDown then try renaming the callback to onLButtonUp. I recall back in the v8 days there were some quirks with one or the other callback method (I think on Mac platform mostly.)

  • Request Section Management Panel

    6
    0 Votes
    6 Posts
    37 Views
    alexpacio2013A

    @Rich-O-Brien I know many other solutions but They are tricks to get around the problem but the problem remains it is not possible to manage sections scenes in a simple way. It would need a panel to manage the sections anyway thanks for the suggestion.

  • [Code] realign UVs, or: convert projective to affine

    10
    0 Votes
    10 Posts
    1k Views
    C

    @TIG said in [Code] realign UVs, or: convert projective to affine:

    @chris341

    It is a very old thread !
    I've fixed the basic syntax errors and added modules etc.
    It works in v2024 [should be OK in v2020] - but I'm unsure of its efficacy...
    Aerilius_UV_realign_uvs.rb

    Haha yes!! This seems to work, at least at first glance. Just one texture exported. Thank you so much! I will report back if I have any other issues with it.

  • Edit Signature

    Solved
    2
    0 Votes
    2 Posts
    21 Views
    BoxB

    Click your avatar, the olive coloured circle with O in it at the top right of your screen, select Edit Profile from the dropdown list, scroll down to the signature box...

  • Looking for a developer to help create a custom Component im

    2
    0 Votes
    2 Posts
    33 Views
    P

    Hi. Can I help you ?

  • How to copy a hole component inside to another component ?

    Moved
    1
    0 Votes
    1 Posts
    23 Views
    No one has replied
  • Ruby Sketchup Programmatic Union of Multiple items

    10
    0 Votes
    10 Posts
    2k Views
    Dan RathbunD

    @Sklik-Rab said in Ruby Sketchup Programmatic Union of Multiple items:

    @Dan-Rathbun
    How to check if @union become nil?

    To check if the reference points at nil, you can use:
    @union.nil? which is inherited by Array from Object#nil?

    To check if the array is empty, you can use:
    @union.empty?

  • custom length snapping

    2
    0 Votes
    2 Posts
    33 Views
    G

    length snapping does not get a lot of interest, but i add information on how i solved my problem, in case of somebody might find it useful in the future...

    in my case length snapping was not the solution
    2024-04-27 11_39_13-MTX_composant_par_classe et 5 pages de plus - Personnel – Microsoft​ Edge.png

    The cursor movement is not changed; instead, a message is shown based upon the movement of the mouse, so the user can decide when it is time to stop moving the mouse and click the second point
    https://vimeo.com/939627532?share=copy

    this is low level programming, but it works.

  • Joint Push Pull

    7
    0 Votes
    7 Posts
    2k Views
    fredo6F

    @sajid1999

    This is normal. If you change your PC, the unique hardware ID changes.

    You can release old seats on this page (you'll need to sign-in)

  • Making a selection in a ruby script and applying command

    9
    0 Votes
    9 Posts
    42 Views
    TIGT

    @hollymichel
    No, it doesn't read a lot better.
    You must add the 'code' tag and put your Ruby code inside it.
    Then the start and end tags [i.e. three back-quotes each: note I put spaces in front here to prevent the forum thinking it was more code...

    ``` ### ruby code text goes here ```

    ] they must both be on their own lines.
    Which looks like this in the post.

    ### ruby code text goes here

    Simplify your process, and make it more complex only when you've got some good results.
    Trying to do it all in one go is just too difficult.

    How do you eat an elephant - take small bites !

  • Steps to create plugin

    3
    0 Votes
    3 Posts
    55 Views
    TIGT

    @EdwardJ82
    There are many RB files [unencrypted text] available in the PluginStore,
    https://sketchucation.com/pluginstore
    There are also shorter 'snippets' attached to some posts in this forum.
    You should get very simple examples and try to understand how they work.
    You also need to understand how the API works...
    https://ruby.sketchup.com/

  • Select last entity

    18
    0 Votes
    18 Posts
    2k Views
    M

    This is quite useful for selecting the last object extension. Could there be a variation of this that selects and zooms into the last object?

  • Edit_transform not available in the C-API?

    3
    0 Votes
    3 Posts
    9 Views
    pixelcruncherP

    @dan rathbun said:

    The C API is mainly written to act upon files.
    There is only some limited things you can do with "live" models.
    Currently, the C API cannot be used to modify the active model.

    You can get the active edit path via: SUModelGetActivePath()
    ... and from it the transform via: SUInstancePathGetTransform()

    Thanks, Dan, for the information! I solved it in my code by having a ModelObserver, implementing onActivePathChanged, and passing it to my C-extension code.

    Even though you cannot modify the active model, you still need to know the edit transformation for some cases. If a user opens a model to edit, if you query the instance transformation, it will be a world-coordinate transformation instead of a transformation relative to the parent. My C code assumes transformations relative to the parent, so I must calculate that using the edit transformation. You probably already knew this, but I'm putting it here for posterity.

    Cheers,
    Thomas

  • [code] extract png thumbnail image from .skp file

    19
    0 Votes
    19 Posts
    5k Views
    Dan RathbunD

    @jkoll66 said:

    I know this post is like a thousand years old, but I was using the "extract_png.rb" from "Jim". It doesn't seem to work in SU2023. I need this to compile a catalogue of all of my components. Is there an updated version out there somewhere? I really need this. Thanks in advance!

    If you are doing this from within SketchUp, try something like:

    # SketchUp 2015 or later. def export_thumbnails(source_path = nil, dest_path = nil) # unless source_path && File.directory?(source_path) models = Sketchup.active_model.path if models.empty? models = File.join(ENV['HOME'], 'Documents') end # source_path = UI.select_directory( title; "Select Model Directory", directory; models ) return unless source_path end # unless dest_path && File.directory?(dest_path) images = Sketchup.active_model.path images = source_path if images.empty? # dest_path = UI.select_directory( title; "Select Image Output Directory", directory; images ) return unless dest_path end # Dir.glob( '*.skp', base; source_path ) do |skp| source_file = File.join(source_path, skp) image_file = skp.split('.')[0] << '.png' output_file = File.join( dest_path, image_file ) Sketchup.save_thumbnail(source_file, output_file) end # Dir loop # end ###
  • How to retrieve the structure of instance up to model?

    3
    0 Votes
    3 Posts
    5 Views
    Dan RathbunD

    @areal3d said:

    hello,
    how can i get the whole path as in the pickhelper from a selected instance?

    You will either need to build an InstancePath as you drill down or get the Model.active_path and add the selected instance to it.

  • Ruby and special characters

    10
    0 Votes
    10 Posts
    10 Views
    Dan RathbunD

    @tig said:

    In the very first line of your Ruby RB file add this.

    # encoding; UTF-8

    This should ensure your own code is properly formatted.

    This magic comment does not ensure that the code file is saved as UTF-8 w/o BOM.
    This must be set in whatever code editor is being used.

  • Defining position of input box created via ruby

    2
    0 Votes
    2 Posts
    11 Views
    Dan RathbunD

    @areal3d said:

    is there any way to controll the position of the ruby inputbox on the screen,
    just to put it a bit away from the center of the screen?

    Sorry, Stan. NO the UI.inputbox method always centers the dialog.

  • Extension using c#

    10
    0 Votes
    10 Posts
    5k Views
    M

    @icehuli said:

    Someone might be interested in using c# and .net stuff.
    I created a very simple example to write a ruby extension in c#.
    https://bitbucket.org/icehuli/sucsexttutorial

    can you guide me to run the sample code

  • SKP 2023 - german translation

    2
    0 Votes
    2 Posts
    0 Views
    TIGT

    Königsblau = Royal Blue [plain wrong!]
    Ruby-Konsole = Ruby Console [simply correct]

Advertisement