Lisp to orbit viewport

Lisp to orbit viewport

Anonymous
Not applicable
958 Views
6 Replies
Message 1 of 7

Lisp to orbit viewport

Anonymous
Not applicable

How would you go about rotating or (orbiting) a viewport to a 3D view. Even like just immitating clicking the home icon on the view cube but keeping the same object in the viewport.

Please share any thoughts, Thank you!

0 Likes
959 Views
6 Replies
Replies (6)
Message 2 of 7

CodeDing
Advisor
Advisor

@Anonymous ,

 

Well, rotating the view is not exactly the hard part. The zoom level and keeping an object in view is more difficult. 

 

Can you perhaps provide a sample drawing with 2 viewports in it? One viewport showing the beginning stage, and one showing the final stage?

 

Best,

~DD

0 Likes
Message 3 of 7

Anonymous
Not applicable

Here is an example for you to look at.
So, the top viewport is what im starting with and am able to automatically populate for our drawings we are producing. However, I would like to take it just one step further and get it close to what it should look like. There will be minor tweaking from user at the end but that one step will help a lot. 

The bottom view depicts a power pole structure which we have to show in a 3D view 

 

I will attach my code I am using to populate our sheets which i am still working on maybe you will find it useful. Maybe if you have time you can tell my why it wont process the entire list of lists, it ony does one group at a time.

 

Thank you

 

 

 

 

sbrathovd_0-1613665743246.png

sbrathovd_0-1613666584159.png

 

 

0 Likes
Message 4 of 7

Sea-Haven
Mentor
Mentor

If you look at the -viewport command you can set 3d view direction by simple x,y,z values, simple use 1,1,1 a 3d view, for front on etc replace a 1 with zero and you can use zoom C pt scale, this can be automated when creating viewports in a layout.

 

 

(if (= look "R")(command-s "-vpoint" "1,0,0"))
(if (= look "L")(command-s "-vpoint" "-1,0,0"))
(if (= look "F")(command-s "-vpoint" "0,-1,0"))
(if (= look "B")(command-s "-vpoint" "0,1,0"))
(if (= look "P")(command-s "-vpoint" "0,0,1"))
(if (= look "3")(command "_.vpoint" "1,1,1"))

(command "_.zoom" "all")

(setq zc (getpoint "\nPoint to centre of view in Viewport:"))
(command "zoom" "C" zc scl)

 

0 Likes
Message 5 of 7

CodeDing
Advisor
Advisor

@Anonymous ,

 

Sorry for not getting back sooner, but your request is a bit unique in nature and will have a solution only custom to your setup it seems. With that said, I'm basically trying to say that we can get you in a good direction, but you will still have plenty of leg work to get implemented for your case.

 

@Sea-Haven provided some easy and useful info about setting the current view based on some user input. Perhaps that can help you. You may also want to look into some other VIEW related system variables, commands, and functions:

(setview ...) <-- this pairs well with (tblsearch ...)

(tblsearch "VIEW" ...) <-- setup a Model View (VIEW Command) then experiment w/ this function.

About Defining 3D Views With Coordinates or Angles

Commands for Controlling 3D Projection

 

In your case, I'm not sure how the utility pole is created, but if is a cylinder, perhaps that can be easy enough to determine your 3D projection side view.

 

Best,

~DD

0 Likes
Message 6 of 7

Sea-Haven
Mentor
Mentor

The sequence would be, make a view port, pick a point plan view say pole centre, then set vpoint 0,-1,0, then zoom c scale. note if you have poles behind they will appear as well, so you probably want a view direction option in the pan view a line behind pole with thickness on a non plottable layer will acts as a barrier to the see through effect.

0 Likes
Message 7 of 7

Sea-Haven
Mentor
Mentor

So if you have multi viewports could be as simple as this as a start. You would just zoom in to a pole so can pick a base point, as mentioned will show those behind.

 

 

(defun c:zvw ( / scl pt)
(setq pt (getpoint "\nPick point"))
(command "vpoint" "0,-1,0")
(command "zoom" "c" pt 600)
(princ)
)

 

  screenshot343.png

0 Likes