0

I would like to add to the viewport a second system of reference and place it on a specific position of the model. I can see an example image in the documentation Part1 but looking in the sample code I am not able to figure out how to do it.

I tried to create an instance of the CoordinateSystemIcon class but, if I add its entities to the viewport, I get a null reference exception.

stenio
  • 297
  • 1
  • 10

2 Answers2

1

As far as i know you can't reuse the coordinate system. The one you see in the animated gif on their website is not in the sample they provided. They certainly have access to it so when they made the sample they probably did on their internal version while the retail doesn't have it. But there is UCSActivator object in the viewport (eyeshot 11-) or model (eyeshot 12+) which look like it but not as much as drawing it yourself would.

I would suggest you make it yourself. Anyhow you already have all the information you need to draw it. you need your origin and the 3 vectors. I will point you toward the arrow sample which show you how to create these arrows with a single method. The steps to recreate this ucs are pretty simple

Steps :

  1. Create Sphere color Red @ origin
  2. Create arrow color Red @ origin toward X vector
  3. Create arrow color Green @ origin toward Y vector
  4. Create arrow color Blue @ origin toward Z vector
  5. Create a text at end of X vector with text "X"
  6. Create a text at end of Y vector with text "Y"
  7. Create a text at end of Z vector with text "Z"
Franck
  • 4,438
  • 1
  • 28
  • 55
  • There is one drawback though: the axes get scaled after a zooming operation. – stenio Jan 30 '20 at 10:15
  • @stenio that's because they are not drawn in the viewport/model, they are drawn in the overlay. There is a sample that show how to draw entities on the overlay. These can be zoom invariant so they stay the same size for you. [Here is the sample](https://www.devdept.com/Support/Samples#ruler) i am talking about. It overlay a grid in this case but you can do the same with entities. – Franck Jan 30 '20 at 13:00
  • @Frank Yes, you are right. Unfortunatelly the ruler sample is not suitable for the the axes, because there are rotations involved and not only scaling operations or translations. I tried with this code ["Zoom invariant / Position Invariant entity"](https://devdept.zendesk.com/hc/en-us/articles/360015798814-Zoom-invariant-Position-Invariant-entity). It doesn't work properly: the axes moves away when a zoom opertaion is performed. The rotation instead works. – stenio Jan 30 '20 at 17:36
  • I've added a comment to the page [Zoom invariant / Position Invariant entity](https://devdept.zendesk.com/hc/en-us/articles/360015798814-Zoom-invariant-Position-Invariant-entity) in which it is possible to see why the suggested code is not working. – stenio Feb 03 '20 at 08:46
  • I would simply override the `Viewport`/`Model` `overlay` method and draw the UCS zoom invariant over the screen. – Franck Feb 03 '20 at 13:11
1

As explained here, it's a new feature that will be available in Eyeshot 2020.

ilCosmico
  • 1,319
  • 15
  • 26