SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
38 stars 10 forks source link

Layout Ruby API is missing the Update Model Reference feature #590

Open MrPaulch opened 3 years ago

MrPaulch commented 3 years ago

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

DanRathbun commented 3 years ago

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

thomthom commented 3 years ago

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

MrPaulch commented 3 years ago

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.

DanRathbun commented 3 years ago

(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.)

sketchupbot commented 3 years ago

Logged as: SKEXT-3180

sketchupbot commented 3 years ago

Logged as: SKEXT-3181