Git Product home page Git Product logo

Comments (12)

rsheldiii avatar rsheldiii commented on September 2, 2024

Hey there!

For a brief example of how to use the new script you can check out the description on thingiverse: https://www.thingiverse.com/thing:468651 specifically this guy:

No more profile arrays! keys are generated by stringing together nestable functions, which are much, much more readable. translate_u(0, 1) 2u() dcs_row(1) alps() key(); would generate an alps-compatible DCS row 1 keycap that's 2 units long, and translated 1 unit in the y direction. The ordering is important; key() has to be last and there are some other gotchas, so generally stick with [translate] [length] [height] [type] [stem]. Iterations can be applied to these chains to quickly generate key layouts. The new entrypoint for this is keys.scad; key.scad is now meant as more of a construction library for super detailed stuff.

but I should definitely include a readme in the github repo once all is said and done. Basically, everything in keys.scad is just manipulating special variables that are the parameters to key.scad, changing the shape of the key. Since special variables are scoped to the module they are redefined in, all the functions in keys.scad reference the children() function and need to be nested. translate_u(0, 1) 2u() dcs_row(1) alps() key(); is just shorthand for

 translate_u(0, 1){
    2u(){
      dcs_row(1){
        alps(){
          key();
        } 
      }
    }
  }  

where every function except for key() is just modifying the parameters that key() uses to generate the keycap. I can write a reference table for the modifier functions available but for now your best bet is reading keys.scad.

As to why your keycaps are rendering solid, I believe you aren't specifying a stem profile. The current stem profiles are cherry, alps, and rounded cherry, which can be accessed via cherry(), alps(), and rounded_cherry() respectively. dcs_row(1) cherry() key() should get you something similar to your picture, but with a square cherry stem. I should probaby default to cherry, that's what most people will be using the library for.

Openscad does support unicode text objects but they must be referenced by code, not pasted into the document. The wikipedia page doesn't have a hyperlink so I'll just paste in the snippet that mentions it:

image

seen here, somewhere.

Let me know if that answers your questions and if there's anything else you need!

from openscad-projects.

edasque avatar edasque commented on September 2, 2024

All right, so I think I get it. I was modifying /key/key.scad (I am guessing /key/key_v2.zip is not ready for prime time) but really I should be changing keys.scad and specifically these last few lines:

for (row=[1:4]) {
    stem_rotation = 25;
    text="e";
  for (column = [1:1]) {
    translate_u(column - 1, 4 - row) dcs_row(row) cherry_key();
  }
}

This works and the long bars don't render so we're good. Where should I place the changes to stem_rotation & text ? They don't seem to work there. I am just learning OpenScad so it's probably obvious. I am guessing it's not about changing the variable but calling the right function in the chain?

from openscad-projects.

shendriksza avatar shendriksza commented on September 2, 2024

I also get solid keycaps with no visible stems. Was there something specific you did to get it to work?
Even rsheldiii's example of dcs_row(1) cherry() key(); gives a solid keycap

from openscad-projects.

edasque avatar edasque commented on September 2, 2024

@shendriksza it doesn't for me. Are you editing keys.scad ? Do you see these big bars, what does it look like in render mode? What version, platform for OpenScad?

from openscad-projects.

edasque avatar edasque commented on September 2, 2024

Actually, let me correct that, you are right @shendriksza with the most recent two commits, I don't have stems anymore.

dcs_row(1) cherry() key(); at the bottom of keys.scad renders without caps

@rsheldiii any idea? I don't see stems or those long rectangular cuboid

from openscad-projects.

rsheldiii avatar rsheldiii commented on September 2, 2024

on 6af3e25 everything is working just fine for me:

image

on both mac and pc. I would double check that you are up to date on master, I would also close and restart openscad, as sometimes it doesn't take changes from included files into effect. I think the most likely culprit is switching from numbers to strings for the $stem_profile variable. if the problem still persists, can you run

dcs_row(1) cherry() {
    echo($stem_profile);
    key();
}

and tell me what pops out in the console? it should be "cherry"

as to your previos question @edasque you need to modify the special variables instead of the local variables to effect changes to the keycap, so if you modify your script to say

for (row=[1:4]) {
    $stem_rotation = 25;
    $text="e";
  for (column = [1:1]) {
    translate_u(column - 1, 4 - row) dcs_row(row) cherry() key();
  }
}

it should work. there is the legend() function which allows you to specify text (and inset), but the rotated() function only does 90 degrees right now, I can patch it to allow for a rotation variable. what are you doing with 25 degree rotated stems though?

from openscad-projects.

edasque avatar edasque commented on September 2, 2024

I’ll try that and let you know.

The rotate 25 was just so I could be sure it was working, it’s easier to notice than 90. 90 is what I’ll want though.

from openscad-projects.

edasque avatar edasque commented on September 2, 2024

Yeah, so with OpenSCAD version 2015.03-3 on MacOS High Sierra:

dcs_row(1) cherry() key();

I still get a filled in keycap (

with

dcs_row(1) cherry() {
    echo($stem_profile);
    key();
}

I get in the console:

Compiling design (CSG Tree generation)...
ECHO: "cherry"
Compiling design (CSG Products generation)...

with

for (row=[1:4]) {
    $stem_rotation = 25;
  for (column = [1:1]) {
    translate_u(column - 1, 4 - row) dcs_row(row) legend("Y") cherry() key();
  }
}

I did get 4 keycaps but still without a stem.

Note that I don't see those long rectangular columns that I saw in previous versions. When those were there, I could see the stems.

(I restarted OpenScad, closed the files, removed /Users/ed/Library/Caches/org.openscad.OpenSCAD)

from openscad-projects.

rsheldiii avatar rsheldiii commented on September 2, 2024

ah, I'm on 2017.01:20 and 2017.02.08 on windows and mac. downgrading reproduces the issue, I'll see if I can fix it, but in the meantime upgrading to the development snapshot should fix the issue for both of you as well

from openscad-projects.

rsheldiii avatar rsheldiii commented on September 2, 2024

master should be fixed, I was doing something funky with the special variables you probably shouldn't be allowed to do. I'm going to be merging in tweaks I've made to the stem and support momentarily, if you want just the fix you can stick to 79d278b

from openscad-projects.

shendriksza avatar shendriksza commented on September 2, 2024

Sorry for only getting back now, timezones and stuff. Yes I was also using the 2015.03-2 OpenSCAD build for Windows, I didn't even realise there was a development build until you mentioned it. I'm definitely switching over to that one anyway, although most users will probably be using the old stable one so I still think the fix is necessary. But thanks for everyone's effort!

from openscad-projects.

edasque avatar edasque commented on September 2, 2024

Same here, switched to that and the dev build, no issues now. Thank you for your help! We're both makers & developers from Boston.

from openscad-projects.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.