How to receive correct coordinates of all vertexes?
-
How to receive correct coordinates of all vertexes in selection, including all the nested groups and components.
Multiplication of transformations far not always gives correct result, especially if for any nested group(component) of an axis do not coincide with an axis of group(component) in which it is enclosed.I was trying so:
... @lines = [] extract_lines(group.entities, (Geom;;Transformation.new)) ... def extract_lines(ents, tr) ents.each do |e| if e.typename == "Edge" line = [e.vertices[0].position, e.vertices[1].position] line[0] = tr * line[0] line[1] = tr * line[1] @lines << line elsif e.typename == "Group" extract_lines(e.entities, (e.transformation * tr)) elsif e.typename == "ComponentInstance" extract_lines(e.definition.entities, (e.transformation * tr)) end end endBut here the relative positioning of groups concerning a model is not considered.
There are ideas as it to make? -
Hi Alex,
Your sample code looks fine for me. Could you post a simple model showing wrong coordination's readout?
Tomasz
-
Correctly it will be whew:
... @lines = [] extract_lines(group.entities, group.transformation)#!!! ... def extract_lines(ents, tr) ents.each do |e| if e.typename == "Edge" line = [e.vertices[0].position, e.vertices[1].position] line[0] = tr * line[0] line[1] = tr * line[1] @lines << line elsif e.typename == "Group" extract_lines(e.entities, (tr * e.transformation))##!!! elsif e.typename == "ComponentInstance" extract_lines(e.definition.entities, (tr * e.transformation))#!!! end end endand it works!

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement