


{"id":350181,"date":"2024-02-09T17:14:10","date_gmt":"2024-02-09T17:14:10","guid":{"rendered":"\/forum\/forums\/topic\/face-split-in-design-modeler-scripting\/"},"modified":"2024-02-09T17:14:10","modified_gmt":"2024-02-09T17:14:10","slug":"face-split-in-design-modeler-scripting","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/face-split-in-design-modeler-scripting\/","title":{"rendered":"Face split in design modeler scripting"},"content":{"rendered":"<p>Hi all,&nbsp;<\/p>\n<p>I am trying to apply a face split command to an extruded skecth using design modeler scripting and I am not sure how to do so.&nbsp;<\/p>\n<p>Attached is my code to create the sketch and extrude it.<\/p>\n<p>Any help will be greatly appreciated<\/p>\n<div>\/\/DesignModeler JScript, version: Ansys DesignModeler 2021 R2 (Jun 1 2021, 09:34:08; 21,2021,151,1) SV4<\/div>\n<div>\/\/Created via: &#8220;Write Script: Sketch(es) of Active Plane&#8221;<\/div>\n<div>\/\/ Written to: C:\\Users\\47111601\\Downloads\\HK_Ansys\\HK_Ansys2021\\SYS-2.js<\/div>\n<div>\/\/ On: 02\/06\/24, 23:16:48<\/div>\n<div>\/\/Using:<\/div>\n<div>\/\/ agb &#8230; pointer to batch interface<\/div>\n<div>&nbsp;<\/div>\n<div>\/\/Note:<\/div>\n<div>\/\/ You may be able to re-use below JScript function via cut-and-paste;<\/div>\n<div>\/\/ however, you may have to re-name the function identifier.<\/div>\n<div>\/\/<\/div>\n<div>&nbsp;<\/div>\n<div>function planeSketchesOnly(p) {<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; \/\/Plane<\/div>\n<div>&nbsp; &nbsp; p.Plane = agb.GetActivePlane(); \/\/ Retrieve the YZ plane<\/div>\n<div>&nbsp; &nbsp; var YZPlane = agb.GetYZPlane();<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; \/\/ Set YZ plane<\/div>\n<div>&nbsp; &nbsp; p.Plane = YZPlane;<\/div>\n<div>&nbsp; &nbsp; p.Origin = p.Plane.GetOrigin();<\/div>\n<div>&nbsp; &nbsp; p.XAxis = p.Plane.GetXAxis();<\/div>\n<div>&nbsp; &nbsp; p.YAxis = p.Plane.GetYAxis();<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; \/\/Sketch<\/div>\n<div>&nbsp; &nbsp; p.Sk1 = p.Plane.NewSketch();<\/div>\n<div>&nbsp; &nbsp; p.Sk1.Name = &#8220;Sketch1&#8221;;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; \/\/Edges<\/div>\n<div>&nbsp; &nbsp; with(p.Sk1) {<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; p.Ln7 = Line(0.00000000, 6.00000000, 0.20465000, 6.00000000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; p.Ln8 = Line(0.20465000, 6.00000000, 0.20465000, -6.00000000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; p.Ln9 = Line(0.20465000, -6.00000000, -0.20465000, -6.00000000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; p.Ln10 = Line(-0.20465000, -6.00000000, -0.20465000, 6.00000000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; p.Ln12 = Line(0.00000000, 6.00000000, -0.20465000, 6.00000000);<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; \/\/Dimensions and\/or constraints<\/div>\n<div>&nbsp; &nbsp; with(p.Plane) {<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; \/\/Dimensions<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; var dim;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; dim = HorizontalDim(p.Ln7.Base, 0.00000000, 6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Ln7.End, 0.20465000, 6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.35164860, 8.54551913);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; if (dim) dim.Name = &#8220;H1&#8221;;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; dim = HorizontalDim(p.Ln9.Base, 0.20465000, -6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Ln9.End, -0.20465000, -6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.02566448, -7.24440432);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; if (dim) dim.Name = &#8220;H4&#8221;;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; dim = VerticalDim(p.Origin, 0.00000000, 0.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Ln7.End, 0.20465000, 6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.88851166, 5.68672685);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; if (dim) dim.Name = &#8220;V2&#8221;;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; dim = VerticalDim(p.Ln8.Base, 0.20465000, 6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Ln8.End, 0.20465000, -6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1.32459557, 0.28560604);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; if (dim) dim.Name = &#8220;V3&#8221;;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; \/\/Constraints<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; HorizontalCon(p.Ln7);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; HorizontalCon(p.Ln9);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; HorizontalCon(p.Ln12);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; VerticalCon(p.Ln8);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; VerticalCon(p.Ln10);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; CoincidentCon(p.Ln7.Base, 0.00000000, 6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.YAxis, 0.00000000, 4.48815214);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; CoincidentCon(p.Ln8.Base, 0.20465000, 6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Ln7.End, 0.20465000, 6.00000000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; CoincidentCon(p.Ln9.Base, 0.20465000, -6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Ln8.End, 0.20465000, -6.00000000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; CoincidentCon(p.Ln10.Base, -0.20465000, -6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Ln9.End, -0.20465000, -6.00000000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; CoincidentCon(p.Ln12.Base, 0.00000000, 6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Ln7.Base, 0.00000000, 6.00000000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; CoincidentCon(p.Ln12.End, -0.20465000, 6.00000000,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.Ln10.End, -0.20465000, 6.00000000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; EqualLengthCon(p.Ln10, p.Ln8);<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; p.Plane.EvalDimCons(); \/\/Final evaluate of all dimensions and constraints in plane<\/div>\n<div>&nbsp; &nbsp; \/\/ Extrude the sketch only in the X-direction<\/div>\n<div>&nbsp; &nbsp; var ext1 = agb.Extrude(agc.Add, p.Sk1, agc.DirX, agc.ExtentFixed, 72, agc.ExtentFixed, 0.0, agc.No, 0.0, 0.0);<\/div>\n<div>&nbsp; &nbsp; agb.Regen(); \/\/ Regenerate the model to ensure validity<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; return p;<\/div>\n<div>} \/\/End Plane JScript function: planeSketchesOnly<\/div>\n<div>&nbsp;<\/div>\n<div>\/\/Call Plane JScript function<\/div>\n<div>var ps1 = planeSketchesOnly(new Object());<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"template":"","class_list":["post-350181","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["336175","170445"],"_bbp_author_ip":["23.206.193.154"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["1164"],"_bbp_topic_status":["unanswered"],"_bbp_topic_id":["350181"],"_bbp_forum_id":["27789"],"_bbp_engagement":["170445","336175"],"_bbp_voice_count":["2"],"_bbp_reply_count":["3"],"_bbp_last_reply_id":["351169"],"_bbp_last_active_id":["351169"],"_bbp_last_active_time":["2024-02-13 08:10:57"]},"test":"hkhresatsmu-edu"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/350181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/350181\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=350181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}