Skip to content

Added object() in cheat sheet for snapshot #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pkriens
Copy link

@pkriens pkriens commented Jul 10, 2025

@jordanbrown0 could you take a look? I am also ok if you want to take this over since you already edited this cheat sheet.

Copy link
Contributor

@jordanbrown0 jordanbrown0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically good. Two requested changes (lower-case anchor for has_key(), don't move section boundary), one recommendation (re-order the object() variants), and a couple of points for discussion that don't require action now.

Comment on lines +225 to +226
</section>
<section>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo: I wouldn't make this particular change, especially as part of this project. Having "Functions" be at the top of a column seems right; burying it under "Other" seems wrong. On the other hand, I don't know why "Type test functions" is before Functions; I'd move it over to after "Functions" or after "Mathematical". But again, Not This Project.

Comment on lines +170 to +177
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(&hellip;,object,&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;copy</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(&hellip;,name=value,&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;assign/override</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(&hellip;,[&hellip;,["name"],&hellip;],&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;remove name</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(&hellip;,[&hellip;,["name",value],&hellip;],&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;add name=value</dd>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation: I would order these as

  • name=value
  • object
  • [[name,value]]
  • [[name]]
    because I think name=value is the most likely variant.

Comment on lines +170 to +177
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(&hellip;,object,&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;copy</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(&hellip;,name=value,&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;assign/override</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(&hellip;,[&hellip;,["name"],&hellip;],&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;remove name</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(&hellip;,[&hellip;,["name",value],&hellip;],&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;add name=value</dd>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opinions solicited: There is an argument that this and has_key() belong over in the "Functions" section.

<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = obj["name"];</a></code></dt>
<dd>&nbsp;&nbsp;get value from object by string</dd>
<dd>&nbsp;&nbsp;get value from object by name</dd>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discuss: Hmm. Using "string" there was deliberate, to emphasize that it was an arbitrary string expression, as opposed to an limited-to-identifier-and-constant name for the next.

Comment on lines +170 to +177
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(&hellip;,object,&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;copy</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(&hellip;,name=value,&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;assign/override</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(&hellip;,[&hellip;,["name"],&hellip;],&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;remove name</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(&hellip;,[&hellip;,["name",value],&hellip;],&hellip;);</a></code></dt>
<dd>&nbsp;&nbsp;add name=value</dd>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Futures: I have mixed feelings about the "name" style, with the quotes. There are examples both ways through the cheat sheet, showing a sample value or showing the name of the argument. One would hope that people would understand that "name" is a sample and that you could use an arbitrary string expression there, but I've seen people who think that in cube([10,10,10]) the brackets are part of the syntax of cube(), or that in rands(1,10,1)[0] the [0] is part of the syntax.

It's certainly fine for now.

We should also work on consistency in how argument names are presented; we have cases where they are plain text, are part of the link or not, are gray, are italics. We have most functions not mentioning their arguments, but a couple do. But Not This Project.

<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = obj.name;</a></code></dt>
<dd>&nbsp;&nbsp;get value from object by identifier</dd>
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Has_key">has_key(object,"name");</a></code></dt>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change: anchors for other functions are in lower case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants