-
-
August 4, 2023 at 7:06 am
NickFL
SubscriberI have a script that creates a set of points and then it draw lines between these points. I then need to move to a new plane, and hence different new sketch, and do the same thing. Both of these planes already have sketches on them, and I want to add these lines to the existing sketches. My goal was to have all this scripted, but it doesn’t seem like there is a way to access the sketch using the Index method, only the SmartVariable method. Is that correct? I have not worked much with these SmartVariable and it does not seem like the user has much control over what is defined.
I am using R23.1 and the API version 23.
-
August 7, 2023 at 12:33 pm
Aniket
Forum ModeratorHi NickFL, have you tried to use the inbuilt feature of using formatted text files that can create the points as well as lines in the model? Please check "Point Curve Text" imports at the following link:
https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/spaceclaim/Discovery/user_manual/file/r_file-operation_import-export_import-file-formats.html
-Aniket
How to access Ansys help links
Guidelines for Posting on Ansys Learning Forum
Â
-
August 7, 2023 at 9:10 pm
mjmiddle
Ansys EmployeeThe smart variable is binary data tied to the model.
I have asked for an enhancement request before to be able to select sketches under a plane using script, but it doesn't look to have been done yet. There is the only way to currently do it, and it's a bit awkward:
Multiple sketches under the same plane can only be made when constraint based sketching is turned on, and you right click on the datum plane to choose "New sketch."Âdp = GetRootPart().DatumPlanes[0]dp.Curves  # a list of all 8 curvesÂdp.GetChildren[DocObject]()This gets a list where every DatumLine,DatumLine,DatumPoint triplet defines a sketch plane under the datum plane. DesignCurves are also in the list for actual sketched curves. It will also list SketchConstraint types. For example, with one datum plane and two sketches under the plane with 4 curves under each sketch, you get a list in this order after the SketchConstraint types:DatumLineDatumLineDatumPointDesignCurveDesignCurveDesignCurveDesignCurveDatumLineDatumLineDatumPointDesignCurveDesignCurveDesignCurveDesignCurveÂYou could check this list for the DatumLine,DatumLine,DatumPoint triplets, and each triplet found is a sketch in the order listed. -
August 8, 2023 at 6:28 am
NickFL
SubscriberThank you both. I am glad I wasn't missing something straightforward. Maybe one day the developers will listen to us and that functionality will appear ? . Until then, your input has given me a couple things to try, and I have a couple of avenues now to pursue. Thanks again!
-
- The topic ‘SCDM – Accessing Sketch from Script’ is closed to new replies.
-
3442
-
1057
-
1051
-
917
-
896
© 2025 Copyright ANSYS, Inc. All rights reserved.