microsoft / microsoft/maker.js

model outline not working with some values.

Open
#546 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2k
Forks
302
Avg merge
21h 28m
Merged PRs (30d)
5

Description

Hi

I am using model outline but with some values is not working

2022-12-30_01-02-28

Example to reproduce:

var MakerJs = require('makerjs');


function Example(radius, width, inset, rcorner) {
  if (arguments.length === 0) {
    var defaultValues = MakerJs.kit.getParameterValues(Example);
    radius = defaultValues.shift();
    width = defaultValues.shift();
    inset = defaultValues.shift();
    rcorner = defaultValues.shift();
  }

  var right = new MakerJs.paths.Line([radius, 0], [radius + width, 0]);
  var barc = new MakerJs.paths.Arc(MakerJs.point.zero(), radius + width, 0, 90);
  var left = new MakerJs.paths.Line([0, radius + width], [0, radius]);
  var sarc = new MakerJs.paths.Arc(MakerJs.point.zero(), radius , 0, 90);

  // Corners if rounded
  var first = MakerJs.path.fillet(sarc, right, rcorner);
  var second = MakerJs.path.fillet(right, barc, rcorner);
  var third = MakerJs.path.fillet(barc, left, rcorner);
  var fourth = MakerJs.path.fillet(left, sarc, rcorner);

  var top = {
    paths: {
      first: first, right: right, second: second,
      barc: barc, third: third, left: left, fourth: fourth,
      sarc: sarc
    }
  };
  
  top.layer = 'red';
  
  var eouter = MakerJs.model.outline(top, inset, 1, true);
  var einner = MakerJs.model.outline(eouter, 15, 1, true);
  var router = MakerJs.model.outline(eouter, 1, 1, true);
  var rinner = MakerJs.model.outline(einner, 1, 1);
  
  eouter.layer = 'aqua';
  einner.layer = 'aqua';
  router.layer = 'yellow';
  rinner.layer = 'yellow';

  this.models = {
    top: top,
    eouter: eouter,
    einner: einner,
    router: router,
    rinner: rinner
  };

}

Example.metaParameters = [
  { title: "radius", type: "range", min: 100, max: 2000, value: 250 },
  { title: "width", type: "range", min: 100, max: 2000, value: 250 },
  { title: "inset", type: "range", min: 1, max: 20, value: 2 },
  { title: "rcorner", type: "range", min: 0, max: 100, value: 0 }
];


module.exports = Example;

Regards

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the JavaScript reproduction in the issue and compare the model outline output for the shown parameter values. Trace the MakerJs.model.outline calls, especially the nested outlines and corner settings, to identify where the result stops working. Done means the supplied example produces the expected outlines across the problematic values, with a regression check if the project has a relevant test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.