Giter Site home page Giter Site logo

Error: Duplicate lpart id's about laserscad HOT 4 CLOSED

mbugert avatar mbugert commented on July 26, 2024
Error: Duplicate lpart id's

from laserscad.

Comments (4)

mbugert avatar mbugert commented on July 26, 2024

Hi Ken,

the library requires each lpart to have a unique name so that it can identify them during the arrangement process later on. You define an lpart named pad and instantiate it three times, therefore it returns Error: Duplicate lpart id's: pad.

A quick fix would be to include the diameter in the lpart names, i.e. by writing lpart(str("pad", diam), [diam, diam]) and lpart(str("pad_with_hole", odiam, idiam), [odiam, odiam]).

If you need multiple pads of the same diameter, this will fail for the same reason as before of course. You could then do the following:

include <laserscad.scad>

kerf = 0.5;
thickness = 3;
$fn = 200;
font_color = "black";
font_size = 1.5;

module pad(diam, id="") {
    lpart(str("pad", diam, id), [diam, diam]) {
        lengrave(thickness, true){
            color(font_color)
            text(font="DejaVu Sans", size=font_size, str(diam),
            halign="center", valign="center");
        }
        cylinder(h=thickness, d=diam + kerf);
    }
}

for (x=[1:4], y=[1:4]) {
    translate([x*10,y*10,0])
        pad(8, id=str(x,y));
}

from laserscad.

krbeesley avatar krbeesley commented on July 26, 2024

from laserscad.

mbugert avatar mbugert commented on July 26, 2024

Yeah, I agree that it's not particularly obvious from the readme. I'll update that.

Iโ€™ll get back on it.

๐Ÿ‘๐Ÿ‘

from laserscad.

krbeesley avatar krbeesley commented on July 26, 2024

from laserscad.

Related Issues (15)

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.