cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sight Observer

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.
1 Solution

Accepted Solutions
Anonymous
Not applicable
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.

Go to post

2 Replies 2
is Shawn Hopkins (BIM Bakery) on this forum? They had a sight observer tool for stadiums, hence he may be able to help you.
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists
Anonymous
Not applicable
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.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!