turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Navigation
- Solid Edge
- Forums
- Blogs
- Knowledge Bases
- Contests
- Groups

- Siemens PLM Community
- Solid Edge
- Solid Edge Developer Forum
- Get point coordinates on block occurrences

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-19-2016 05:34 AM

Hello there,

I need to get all the Points2D and Lines2D endpoints coordinates inside a Sheet, including all those Points2d and Lines2d included inside BlockOccurrences placed on that Sheet.

As far as I see, there's no direct simple way of getting, for example, the "global" coordinates of each Point2d o Line2d sendpoints inside the different occurrences of all the blocks. A block can contain another blocks and each one can be rotated and scaled in different ways, which increases difficulty

One approach, not quite easy, is getting position (GetOrigin), ScaleFactor and RotationAngle of each occurrence and then apply those transformations to each of the points/lines inside it. This must be done recursively if we are dealing with blocks inside blocks and so on. Not an easy task.

The other approach is getting references of the different elements using MemberReference property of the BlockOccurrence, and using the transformation matrix provided in order to adjust coordinates to the upper level. Quite spare documentation about this matrix stuff, unfortunately. Also, I'm not sure about what happens with the scale in this case, since that matrix I guess only deals with position and rotation. Recursive thinking is also expected here... Not sure if this is even worse than the first choice!

Before getting absolutely mad with maths and testings, I would love to know if there's not really a simpler approach for getting the FINAL coordinates (refered to the main Sheet origin) of different geometric elements inside BlockOccurrences

Thanks in advance!

Solved! Go to Solution.

2 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-24-2016 03:39 AM

Hi javigoca,

i fear doing the math yourself is the only possibility.

It's not that difficult...

Using the values of the BlockOccurrence you can transform the points of the 2d space of the occurrence plane to the space of the sheet:

Private Sub OccurrenceToSheet(BOcc As SEDraft.BlockOccurrence, xBlock As Double, yBlock As Double, ByRef xSheet As Double, ByRef ySheet As Double) Dim xOrig, yOrig As Double Dim xOccOrig, yOccOrig As Double Dim xTemp, yTemp As Double Dim Angle As Double Dim dSin As Double Dim dCos As Double ' get the origin points BOcc.GetOrigin(xOccOrig, yOccOrig) BOcc.BlockView.GetOrigin(xOrig, yOrig) ' transform point from block system relative to origin xTemp = xBlock - xOrig yTemp = yBlock - yOrig 'scale xTemp = xTemp * BOcc.ScaleFactor yTemp = yTemp * BOcc.ScaleFactor 'rotate Angle = BOcc.RotationAngle If Angle <> 0.0 Then dSin = Sin(Angle) dCos = Cos(Angle) xSheet = dCos * xTemp - dSin * yTemp ySheet = dSin * xTemp + dCos * yTemp Else xSheet = xTemp ySheet = yTemp End If 'move xSheet = xSheet + xOccOrig ySheet = ySheet + yOccOrig End Sub

If you are in some sub BlockOccurrence you have to test for the parent an do this "bottom up" until the parent is the sheet.

If you want to do this for a lot of points, then you can consider to generate a transformation matrix for each BlockOccurrence or sub BlockOccurrence to do this in one step.

There are lots of examples on some math / geometry pages in the web.

Then you could do just a matrix multiply of the transformation matrix with each point to transform it.

hope this helps

regards

JB

SE ST10

JB

SE ST10

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-24-2016 10:19 AM

Yes, it's not too complicated but I was wodering if there was a more direct method to read sheet coordinates, also for making the process a bit faster.

Again, many thanks for the code, it will save me a lot of work.

Follow Siemens PLM Software

© 2018 Siemens Product Lifecycle Management Software Inc