Model.import not working for newbie.
-
I have a very simple script to import a 3ds file.
<span class="syntaxdefault">model </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />fileName </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">"C;\\temp\\B473.3ds"<br /></span><span class="syntaxdefault">show_summary </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> true<br />status </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">import</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">fileName</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> show_summary</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">messagebox</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">status</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">commit_operation</span>
When the script runs I get the Import Process dialog but I get no summary dialog and there is nothing in Sketchup.
model.import
returns true.If I do an import from the File menu all works well.
What am I doing wrong?
-
Can you post sample 3ds model?
-
-
Worked fine for me.. The import is not automatically placed in the model, instead it is attached to the cursor where you need to place it by clicking.
True, the summary dialog did not appear.
-
If you import a 3ds file from the menu there is no summary dialog either, so the argument as true/false in the scripted method is irrelevant as it's ignored and there never is one !
Some importers use that option, 3ds does not...
It works just as the menu version and imports using the last used Options values, like 'units'...Incidentally your code includes a closing
model.commit_operation
but there is no matchingmodel.start_operation("Import3ds")
near the start -
Still doesn't work for me. There is nothing attached to my cursor.
-
Works fine for me...
-
Would this work in the 'free' version of SU or only the 'pro' version?
-
Yes, it would (or at least should)
-
I haven't looked much into this, but it won't work on file formats that SketchUp free does not support, like dwg.
-
So, the free version only has the interfaces GUI blocked for say DXF import, but I could get around that programmically by providing a ruby plug-in or C++ code?
Is there a plug-in for adding back the import functionality that was removed?
-
-
Thanks, That plug-in will do nicely. I have imported a test file and it worked well.
Advertisement