Having issues with point coordinates from user UCS

Having issues with point coordinates from user UCS

tmathieson
Advocate Advocate
466 Views
2 Replies
Message 1 of 3

Having issues with point coordinates from user UCS

tmathieson
Advocate
Advocate

Hello to All, and Season's Best!!  i am having some issues with extracting points/circle center coordinates  as related to a User UCS... i have searched thru this form,  some some useful code and hints from the usual sources, have 'applied' them, but still have issues. i have included the file, and a couple screen shots that i hope explains things a bit.  it seems like my matrix is 'transferring' the X value correctly, but the Y value is way off and i don't know what is going on with the Z, but i only need X and Y values in the UCS system'

 

this is a fairly straight translation/matrix, and i could  get what i need by some simple math, (absolute values of X1-X2, Y1-Y2...), but would like to figure out what i mucked up here for future use....

 

Thanks again in Advance, and have a great day!!

0 Likes
Accepted solutions (1)
467 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

Have a look at this iLogic rule. It will ask you to select a workpoint. Then it will find the first ucs. then it will calculate the transformation matrix (invert the matrix) to transform point data from normal to ucs.

JelteDeJong_0-1704653807920.png

Dim wp As WorkPoint = ThisApplication.CommandManager.Pick(
	SelectionFilterEnum.kWorkPointFilter, "Select a workpoint")
Dim point As Point = wp.Point

Dim doc As PartDocument = ThisDoc.Document
Dim def As PartComponentDefinition = doc.ComponentDefinition

Dim ucs = def.UserCoordinateSystems.Item(1)

Dim tMatix = ucs.Transformation
tMatix.Invert()

point.TransformBy(tMatix)

MessageBox.Show(String.Format("X:{0}, Y:{1}, Z:{2}", 
	Math.Round(point.X * 10, 2), Math.Round(point.Y * 10, 2), Math.Round(point.Z * 10, 2)))

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 3

tmathieson
Advocate
Advocate

thanks @JelteDeJong !!  that was what i needed, the "tmatrix.invert" line!!

 

thanks again, (as always!!), have a great day!!!

0 Likes