Persistent_id for ComponentDefinition always returns zero

According to the API (Class: Sketchup::Entity — SketchUp Ruby API Documentation), persistent ids are supported as of SU2017 and they are all working with the exception of the ComponentDefinition which always returns zero (0).

The following entered in my ruby console with five unique component definitions shows that they do respond to ‘persistent_id’, but always return zero. { |d| [d.respond_to?('persistent_id'), d.persistent_id] } [[true, 0], [true, 0], [true, 0], [true, 0], [true, 0]]

Is this a typo in the documentation or a bug?



What version of SketchUp are you seeing this on ?

Also the public API Issue Tracker is here …

If you go to the Release Notes page, expand SketchUp 2018 and search CTRL+F with your browser, on “persistent” and/or “PID”, you’ll see there were issues that were corrected in this last release.

Meaning, it is not outside the realm of possibility that there are bugs to be fixed.

I’ve tried it in SU2017 and SU2018, both same problem.

Well the next step is to wrap up a test model and reproducible code and attach them to a issue at the Git Issue tracker.

Ok. I’ve attached a test model and a screen capture of the reproducible code.
CaptureTestModel.skp (36.3 KB)

Please see …

It is less of a drain on site resources (than images) and easier to copy and paste.

I did do that on my first post.

So, how do I attach these to the Git Issue tracker?

GitHub thread posts also use markdown so the same way to post code works there as well.

If it allows attaching the file, on WIndows you can drag and drop.
If GitHub doesn’t like .rb or .skp files, just wrap them in a zip archive.

Ie, at the bottom of the GitHub edit box (below the doted line) you’l see …

"Attach files by dragging & dropping, selecting them, or pasting from the clipboard"

… clicking anywhere on that line will bring up a file browser to select a file.

P.S. - Using the Chrome Web Inspector I can see that this input says …
… yes you will need to wrap any .skp files in a zip archive.

But since the code is so simple,… you can just put that in a triple backtick code block.

* There is always a link to the markdown help page at the bottom left of the GitHub issue/thread editbox.

Sorry. I should have asked - where is the Git Issue tracker?

It’s the link in Dan’s first post in this thread.

1 Like

Thanks. I’ve added it to the Git Issue tracker.

And @thomthom points out it is a documentation mistake …

thomthom said in the Git Issue

I looked up the source and found that the documentation isn’t accurate.

The items you get PIDs from are:

Persistent ids are intended for things you find in the model - meaning component instances, but not definitions.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.