Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Is it possible to put a model inside a model, so that the inside model can use constraints from the parent model?

You must be logged in to vote

Replies: 1 comment

Comment options

Yes. The model tree structure does not need to relate to the size of the drawing. Here's an example of a star, which contains a polygon child model, but the polygon is actually larger than its parent (the star):

var makerjs = require('makerjs');

var number_of_sides = 5;
var radius = 70;
var star_outer_radius = 50;
var star_inner_radius = 20;

var poly = new makerjs.models.Polygon(number_of_sides, radius);
var star =  new makerjs.models.Star(number_of_sides, star_outer_radius, star_inner_radius);
  
star.models = {
  poly: poly
};

module.exports = star;
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.