api-issue-tracker icon indicating copy to clipboard operation
api-issue-tracker copied to clipboard

Layout Ruby API is missing the Update Model Reference feature

Open MrPaulch opened this issue 5 years ago • 7 comments

Use Case

A SketchUp Extension wants to modify a SketchUp file which is referenced by a Layout file. The Layout Document needs to be told to update it's SketchUpModel Entities. After that a PDF Export of the updated Layout file is performed.

Missing Feature

To update the SketchUpModel references in the Layout Document currently there is no option to perform a "Update Model References" like there is in the UI.

Example function names

Layout::SketchUpModel.update_model_references and Layout::SketchUpModel.relink_model_references

Current Workaround

A Workaround to this is to remove the SketchUpModel Entity and to insert it again.

However that workaround is buggy as described in this bug report

MrPaulch avatar Dec 21 '20 13:12 MrPaulch

I thought sure that this was mentioned before and logged, but I cannot find it.

DanRathbun avatar Dec 22 '20 00:12 DanRathbun

Sounds like a duplicate of https://github.com/SketchUp/api-issue-tracker/issues/324 (do I read this correctly?)

thomthom avatar Jan 04 '21 13:01 thomthom

Sounds like a duplicate of #324 (do I read this correctly?)

They are not necessarily related.

The mentioned issue talks about the path. Which is only tangentially relevant here.

The update_model_reference would only perform the same task as the same-named context menu entry in Layout when right clicking on a SketchUpModel Entity. Meaning, if there were changes in the original SketchUp file, they are reflected in it's representation in the Layout Document. Of course the path to the original SketchUp file is necessary for this task (internally) but not for the consumer of the API.

(I would not resist having the path attribute exposed, even though it would not help this issue.)

Currently the only way to programmatically update a SketchUpModel Entity in Layout is to remove it and instantiate it. And as mentioned, the procedure is bugged.

MrPaulch avatar Jan 07 '21 11:01 MrPaulch

(I would not resist having the path attribute exposed, even though it would not help this issue.)

I would myself prefer dedicated method(s) to refresh the viewport rather than a 2nd boolean "refresh" argument with a #set_path method.

We would expect a IOError or a Errno::ENOENT (No directory entry) exception if the SKP file does not exist at the previously set path location. (Ie, the internal model within the .layout archive needs to be overwritten with the updated SKP file.)

DanRathbun avatar Jan 07 '21 20:01 DanRathbun

Logged as: SKEXT-3180

sketchupbot avatar Sep 13 '21 06:09 sketchupbot

Logged as: SKEXT-3181

sketchupbot avatar Sep 13 '21 06:09 sketchupbot

+1 for this method. Also need a method to check whether the model reference is modified and needs to be updated

Whaat avatar Dec 05 '24 20:12 Whaat