SOLVED!
Sight Observer
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-09-15 10:45 AM - last edited on 2021-09-14 01:47 PM by Noemi Balogh
2020-09-15
10:45 AM
Hi, guys.
I am trying to make the add-on do something when the sight change. I look into the SDK and find class ISightObserver may relate with my requirement. Could you please help me use it? Is there any sample?
Thanks in advance.
I am trying to make the add-on do something when the sight change. I look into the SDK and find class ISightObserver may relate with my requirement. Could you please help me use it? Is there any sample?
Thanks in advance.
Solved! Go to Solution.
Labels:
- Labels:
-
Add-On (C++)
1 ACCEPTED SOLUTION
Accepted Solutions
Solution
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-09-17 12:03 PM
2020-09-17
12:03 PM
I have solved it. Here is my code (maybe someone will find it helpful):
class MySightObserver: public Modeler::ISightObserver { public: Modeler::Camera cam; void CameraChanged(const Modeler::Camera&); }; MySightObserver mso; MySight::MySight(Modeler::Sight *sig){ mysight = sig; myobserver = &mso; ((MySightObserver*)myobserver)->cam = sig->GetCamera(); sig->Attach(*myobserver); } void MySightObserver::CameraChanged(const Modeler::Camera& newCamera) { if (!newCamera.IsNear(cam)) { /*Your code here*/ } return; }PS: You need to fetch the Modeler::Sight (see my another post) and create an instance of MySightObserver.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-09-15 01:35 PM
2020-09-15
01:35 PM
is Shawn Hopkins (BIM Bakery) on this forum? They had a sight observer tool for stadiums, hence he may be able to help you.
Solution
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-09-17 12:03 PM
2020-09-17
12:03 PM
I have solved it. Here is my code (maybe someone will find it helpful):
class MySightObserver: public Modeler::ISightObserver { public: Modeler::Camera cam; void CameraChanged(const Modeler::Camera&); }; MySightObserver mso; MySight::MySight(Modeler::Sight *sig){ mysight = sig; myobserver = &mso; ((MySightObserver*)myobserver)->cam = sig->GetCamera(); sig->Attach(*myobserver); } void MySightObserver::CameraChanged(const Modeler::Camera& newCamera) { if (!newCamera.IsNear(cam)) { /*Your code here*/ } return; }PS: You need to fetch the Modeler::Sight (see my another post) and create an instance of MySightObserver.