question

Enrique Elizaga avatar image
1 Like"
Enrique Elizaga asked Joshua S answered

Using magnification in ortho view

Hi. I have successfully used view distance ranges in Perspective View to make visual objects appear or disappear to show the level of detail that I desire.

I have not been able to figure out how to do it in Ortho mode though, with the magnification option. Can you please give me some directions?

FlexSim 18.0.3
visual toolortho viewortho view magnification
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joshua S avatar image Joshua S commented ·

Are you changing these values on the OnDraw" Trigger? the notes for this are given when you click the code editor when using "Hide shape and contents at a distance" they read:

A higher "View magnification" value decreases the distance at which the shape becomes hidden in the Orthographic View"

A lower "View distance" value decreases the distance at which the shape becomes hidden in the Perspective View
0 Likes 0 ·
Enrique Elizaga avatar image Enrique Elizaga Joshua S commented ·

@Joshua S I am achieving this (watch attached video): https://youtu.be/TNaf5nMayy8

By usiing this code:

if ( (getnodenum(viewmagnification(view)) > viewmag ||
	getnodenum(viewprojectiontype(view)) == 0) &&
    (distfromviewpoint(current, view) < 8490 && distfromviewpoint(current, view) > 6500)) {
	switch_hidecontents(current,0); // show the contents
	if (getobjectshapeindex(current)==0) // if the shape is hidden
		setobjectshapeindex(current,getshapeindex(gets(shape(current)))); // show the shape
	for (int r=1; r<=content(drawsurrogate(current)); r++) {
		treenode obj = rank(drawsurrogate(current),r);
		switch_hidecontents(obj,0); // show the contents
		if (getobjectshapeindex(obj)==0) // if the shape is hidden
			setobjectshapeindex(obj,getshapeindex(gets(shape(obj)))); // show the shape
	}
	return 0; // default draw code
} else {
	switch_hidecontents(current,1); // hide the contents
	setobjectshapeindex(current,0); // hide the shape
	for (int r=1; r<=content(drawsurrogate(current)); r++) {
		treenode obj = rank(drawsurrogate(current),r);
		switch_hidecontents(obj,1); // hide the contents
		setobjectshapeindex(obj,0); // hide the shape
	}<br>

I understand how it works in perspective mode but not in ortho. Is it the same principle?

0 Likes 0 ·

1 Answer

·
Joshua S avatar image
2 Likes"
Joshua S answered

It works in the same manner. I edited the code:

double ViewFarClip= 12;
double ViewNearClip=70;
print(getnodenum(viewmagnification(view)));
if (getnodenum(viewmagnification(view))> ViewNearClip && getnodenum(viewmagnification(view))<ViewFarClip)  {
	//Draw Cities
} else {
	// Don't Draw Cities
}

this does what your perspective zoom does.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Enrique Elizaga avatar image Enrique Elizaga commented ·

@Joshua S Printing the magnification really helped, as it works differently in ortho mode. As you get farther away the number gets smaller. Now it's working really good and it looks perfect.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.