- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to place a point to locate the center of gravity, both in assemblies and in parts.
I'm using
oCenterOfMass = iProperties.CenterOfGravity
to get the cog, which seems to come in document units (in).
When I go to place a work point though, it seems that it's using database units instead, so the point is in the wrong location:
oWorkpoint = partDoc.ComponentDefinition.WorkPoints.addFixed(oCenterOfMass)
The different types are giving me a lot of trouble. It seems like workpoint.Point, and iproperties.CenterOfGravity should have compatible units. It also seems like I should be able to just go "workpoint.point * 2.54" and have all 3 elements of the coordinate set multiplied by the scalar. Or at the very least go workpoint.point.x = workpoint.point.x * 2.54. But none of those seem to work for me. I've also tried pulling each individual coordinate out, converting to various types, trying to multiply, then trying to put them back into a point type variable, but I can't seem to get that to work either. I haven't tried applying a matrix transformation to it yet, because it seemed like there should be a more straightforward way.
I also tried to figure out how to use workpoint.point.getpointdata(), but it requires a double as input and I clearly don't know VBA well enough to see how this would be used. I tried temp = workpoint.point.getpointdata(), hoping to get a 3 element vector inside temp. Then I tried workpoint.point.getpointdata(temp) hoping for the same thing. No luck.
Can anyone please help explain:
What is the "normal" way to multiply a point by a scalar?
How does getpointdata() work?
What would be the normal way to break a (work)point down into an array/vector, then individual components, manipulate them arbitrarily, then build them back into an array/vector, then back into a point, and then place a workpoint or move an existing one onto those coordinates?
Solved! Go to Solution.