I'm trying to draw an open ended box programatically. I know I need a profile to extrude, but I can't find the profile created by the last SketchLineList.
Maybe I need to draw the shapes explicitly, but it seems like I should be able to extrude them and have the original sketch.
For example, I want to draw this and extrude the highlighted sections here:
While I read in the docs that the profile argument can be a single profile, a single planar face, I can't figure out how to how to get from a LineList to an extruded object.
oSketchLineList = lines.addTwoPointRectangle(adsk.core.Point3D.create(x1, y1, 0), adsk.core.Point3D.create(x2, y2,0))
After this, I try to get the last profile added through something like:
p_index = sketch.profiles.count print("working profile %d" % p_index) profile = sketch.profiles.item(p_index-1)
This produces [1, 2, 3, 5, 5]. So then I created a separate counter for the profiles. This worked even less well.
One way I did get things to work was to create a different sketch for each extrusion. This was really ugly, but at least sketch.profiles.item(0) worked consistently.
Another thought would be to create a complex search routine for profiles that looked at how many loops they had, etc. I tried to attach the files below, but I had to put my code at this gist: https://gist.github.com/tbbooher/042d4ddb7c201d393cfd8d3f545d9a15.
I would love to build an addin to build bookshelves that the community can use, but need to better understand the object model first.
Thanks!
Lauren
It is so strange, every example has sketch.profiles.items(0) or extrudes all profiles.
I've been working with this awhile. This seems like a very basic problem. Any help very appreciated that would steer me in the right direction to solve this. I would think that extruding multiple components is a pretty basic spec for an api.
It's not possible to directly set area properties. Area properties are the result of the current geometry. To change the area properties you need to edit the sketch entities, which will cause the profiles to be recomputed and the area properties to change.