Suggests for import

When I call Sketchup.active_model.import(path, false), I wish the developer could control whether to activate the selection tool. I wish the developer could set a placement position.
Sketchup.active_model.import(path, false,tr)

Because the DefinitionList.load is very very very sloooooowwwwwww be relative to import in very large model.

First of all, the number of arguments in existing API methods cannot be changed because this would break extensions out in the world that are not expecting a different number of arguments.

So your request as written will not happen. It could be a new “import_at” method.

EDIT: However, since 2018 the 2nd arg is an options hash. Additional options CAN be added without being a breaking change. So we could have a :transform option that could skip the placement.

NOTE: The feature request (#271) has been rejected and closed. The API team feels it is too problematic to extend the Sketchup::Model#import method any further.
For more information, please read their reasonings in the linked issue thread.

Also new for SketchUp versions 2021.1 and higher is a DefinitionList#import method.
The method you seek to change has a documentation note that directs readers to this new method if they do not want the placement tool activated.

Have you compared the speed of this new method to Model#import ?


BUT … the real issue is …

This should not be the case and would be the real place to put effort for a fix.


Secondly, this is already possible with existing methods.
I show an example for importing a 3DS file here …

Use it as a starting point to modify for your own use to import a SKP instead.
Basically you must send the SketchUp application an ESC keystroke to cancel the placement of the new imported component instance. Then your code adds an instance of the import using the desired transform.

It is up to you if you wish to explode the new instance (and purge the definition list.)


Please use the options hash or named arguments for SketchUp versions after v2018.

Sketchup.active_model.import(path, show_summary: false)

Are you still running SketchUp 2016 as your forum profile states ?

1 Like

Are you still running SketchUp 2016 as your forum profile states ?

Running Sketchup 2019, thank you for the solution.

Have you compared the speed of this new method to Model#import ?

Yes, The duration is very small in the small model, but The duration is large in the large model (count of faces and edges is 1000000+).

duration is a better word in this context.

A gap is a distance between 2 things or a pass between mountains.

Thank you, my English is not very good.

We all never stop learning.
:wink:

1 Like

By the way, I had already logged this request in the official API tracker 2 years ago

Issue #271 : Allow a Sketchup::Model#import :transform option

NOTE: The above feature request (#271) has been rejected and closed. The API team feels it is too problematic to extend the Sketchup::Model#import method any further.
For more information, please read their reasonings in the linked issue thread.

1 Like

Expect

what ?

Please update your forum profile.


If you are running v2019 then how could you have tested the new DefinitionList#import method as it was just released in version 2021.1.

Is there a reason why you cannot update to the latest version 2021 ?

If you would like the API team to look at why DefinitionList#import or DefinitionList#load is slower than Sketchup::Model#import , then please file an issue in the API tracker with sample models, components and reproducible code snippet.