- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @b.mccarthy. That is a tough question to answer, because how to fix it depends on what type of sketch geometry you have within your 3D sketch. There are many possible types of objects that could be found within it, and we don't know for sure which type you may have, so it would be a guessing game for us to suggest something. If you pre-define the variable's Type ahead of time within the code, like the example above, then try to set a value to that variable by attempting to retrieve one from the sketch, and there is none of them in the sketch, it will throw another error. There are a couple of commented out lines of code in the last example that would help make your code a bit more generic (useful in more scenarios). Instead of looking specifically for a HelicalCurve Type object, you could try looking for the first SketchEntity3d Type object, which would cover much more possible Types of objects. However, that would still be error prone, because some things, such as SketchPoint3d (and others) can not be measured for length. You may have to use a much larger block of code there, which would attempt to loop through all of the entities in the sketch, check what Type they are, then only attempt to 'measure' certain ones. But from the sounds of it, you are describing a SketchSpline3d Type object.
Wesley Crihfield
(Not an Autodesk Employee)