From 6172dded717b5e3633cbfdea836efb584d0171ae Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Mon, 15 Aug 2022 23:22:52 -0700 Subject: [PATCH] fix verification errors for snippets --- dev-guide/snipets-for-modeling-api.js | 166 +++++++++++++------------- 1 file changed, 82 insertions(+), 84 deletions(-) diff --git a/dev-guide/snipets-for-modeling-api.js b/dev-guide/snipets-for-modeling-api.js index d310fd77..c6b762a5 100644 --- a/dev-guide/snipets-for-modeling-api.js +++ b/dev-guide/snipets-for-modeling-api.js @@ -1,165 +1,163 @@ //Make a pipe------------------------------------------------------------------------------------------------------ -const ctx = __CAD_APP; -const { commandInterface: oci, io } = ctx.occService; -oci.beziercurve("spine", "4", +{ + const ctx = __CAD_APP; + const {commandInterface: oci, io} = ctx.occService; + oci.beziercurve("spine", "4", "0", "0", "0", "10", "0", "0", "10", "10", "0", "40", "10", "0", "80", "60", "60" -); -oci.mkedge("spine", "spine"); -oci.wire("spine", "spine"); -oci.circle("profile", "0", "0", "0", "1", "0", "0", "2"); -oci.mkedge("profile", "profile"); -oci.wire("profile", "profile"); -oci.mkplane("profile", "profile"); -oci.pipe("p", "spine", "profile"); - -ctx.services.exposure.addOnScene(io.getShell("p")); - + ); + oci.mkedge("spine", "spine"); + oci.wire("spine", "spine"); + oci.circle("profile", "0", "0", "0", "1", "0", "0", "2"); + oci.mkedge("profile", "profile"); + oci.wire("profile", "profile"); + oci.mkplane("profile", "profile"); + oci.pipe("p", "spine", "profile"); + ctx.services.exposure.addOnScene(io.getShell("p")); +} //Doing a sweep --------------------------------------------------------------------------------------------------- -const ctx = __CAD_APP; -const { commandInterface: oci, io } = ctx.occService; +{ + const ctx = __CAD_APP; + const {commandInterface: oci, io} = ctx.occService; -oci.beziercurve("p", "4", + oci.beziercurve("p", "4", "0", "0", "0", "10", "0", "0", "20", "10", "0", "20", "10", "0"); -oci.mkedge("p", "p"); -oci.wire("p", "p"); + oci.mkedge("p", "p"); + oci.wire("p", "p"); //oci.circle("c","0","0","0","1","0","0","0.2") -oci.polyline("c", + oci.polyline("c", "0", "0", "0", "0", "0", "1", "0", "2", "2", "0", "1", "0", "0", "0", "0"); -oci.wire("w", "c"); + oci.wire("w", "c"); -//dose not seem to work if I convert the profile in to a plane. +//does not seem to work if I convert the profile in to a plane. //Need to figure this out to get a body and not just surfaces. //oci.mkplane("w", "w") -oci.mksweep("p"); - -oci.addsweep("w"); - -oci.buildsweep("r", "-S"); -ctx.services.exposure.addOnScene(io.getShell("r")); + oci.mksweep("p"); + oci.addsweep("w"); + oci.buildsweep("r", "-S"); + ctx.services.exposure.addOnScene(io.getShell("r")); +} //Revolve ------------------------------------------------------------------------------------------------------ -const ctx = __CAD_APP; -const { commandInterface: oci, io } = ctx.occService; +{ + const ctx = __CAD_APP; + const {commandInterface: oci, io} = ctx.occService; -oci.polyline("p", "0", "0", "0", "1", "0", "0", "1", "2", "0", "0", "1", "0", "0", "0", "0"); -oci.mkplane("p", "p"); //make the input in to a face first so that we get capped ends -oci.revol("r", "p", "3", "0", "0", "0", "1", "0", "280"); - - -ctx.services.exposure.addOnScene(io.getShell("r")); - + oci.polyline("p", "0", "0", "0", "1", "0", "0", "1", "2", "0", "0", "1", "0", "0", "0", "0"); + oci.mkplane("p", "p"); //make the input in to a face first so that we get capped ends + oci.revol("r", "p", "3", "0", "0", "0", "1", "0", "280"); + ctx.services.exposure.addOnScene(io.getShell("r")); +} //fillet ------------------------------------------------------------------------------------------------------- -const ctx = __CAD_APP; -const { commandInterface: oci, io } = ctx.occService; +{ + const ctx = __CAD_APP; + const {commandInterface: oci, io} = ctx.occService; -oci.box("b", "20", "20", "20"); -oci.explode("b", "e"); -oci.blend("b", "b", "5", "b_2"); + oci.box("b", "20", "20", "20"); + oci.explode("b", "e"); + oci.blend("b", "b", "5", "b_2"); - -ctx.services.exposure.addOnScene(io.getShell("b")); + ctx.services.exposure.addOnScene(io.getShell("b")); +} //champher ---------------------------------------------------------------------------------------------------- -const ctx = __CAD_APP; -const { commandInterface: oci, io } = ctx.occService; +{ + const ctx = __CAD_APP; + const {commandInterface: oci, io} = ctx.occService; -oci.box("b", "1", "2", "3"); -oci.explode("b", "e"); -var bla = ["ch", "b", "b_1", "0.2", "b_2", "0.2"]; -oci.chamf.call(bla); - -ctx.services.exposure.addOnScene(io.getShell("ch")); + oci.box("b", "1", "2", "3"); + oci.explode("b", "e"); + const bla = ["ch", "b", "b_1", "0.2", "b_2", "0.2"]; + oci.chamf.call(bla); + ctx.services.exposure.addOnScene(io.getShell("ch")); +} //shell ------------------------------------------------------------------------------------------------------- -const ctx = __CAD_APP; -const { commandInterface: oci, io } = ctx.occService; - -oci.box("b", "10", "20", "30"); - -oci.explode("b", "f") -oci.offsetshape("body", "b", "-1", "1.e-3", "b_2", "b_3") - -ctx.services.exposure.addOnScene(io.getShell("body")); +{ + const ctx = __CAD_APP; + const {commandInterface: oci, io} = ctx.occService; + oci.box("b", "10", "20", "30"); + oci.explode("b", "f") + oci.offsetshape("body", "b", "-1", "1.e-3", "b_2", "b_3") + ctx.services.exposure.addOnScene(io.getShell("body")); +} //loft -------------------------------------------------------------------------------------------------------- -const ctx = __CAD_APP; -const { commandInterface: oci, io } = ctx.occService; +{ + const ctx = __CAD_APP; + const {commandInterface: oci, io} = ctx.occService; -oci.polyline("w1", + oci.polyline("w1", "0", "0", "0", "5", "0", "0", "5", "5", "0", "2", "3", "0", "0", "0", "0", -); -oci.polyline("w2", + ); + oci.polyline("w2", "0", "1", "3", "4", "1", "3", "4", "4", "3", "1", "3", "3", "0", "1", "3", -); -oci.polyline("w3", + ); + oci.polyline("w3", "0", "0", "5", "5", "0", "5", "5", "5", "5", "2", "3", "5", "0", "0", "5", -); + ); //# create the shape -oci.thrusections("th", "issolid", "isruled", "w1", "w2", "w3"); - - -ctx.services.exposure.addOnScene(io.getShell("th")); - - + oci.thrusections("th", "issolid", "isruled", "w1", "w2", "w3"); + ctx.services.exposure.addOnScene(io.getShell("th")); +} //Boolean operations --------------------------------------------------------------------- +{ + const ctx = __CAD_APP; + const {commandInterface: oci, io} = ctx.occService; -const ctx = __CAD_APP; -const { commandInterface: oci, io } = ctx.occService; - -oci.box("b1", "10", "10", "10"); -oci.psphere("sp", "5"); + oci.box("b1", "10", "10", "10"); + oci.psphere("sp", "5"); - -oci.bop("b1", "sp"); -oci.bopcommon("result"); + oci.bop("b1", "sp"); + oci.bopcommon("result"); //oci.bopfuse("result"); //oci.bopcut("result"); -ctx.services.exposure.addOnScene(io.getShell("result")); \ No newline at end of file + ctx.services.exposure.addOnScene(io.getShell("result")); +} \ No newline at end of file