Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Sight Observer

Anonymous
Not applicable
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 ACCEPTED SOLUTION

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

View solution in original 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

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

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!