DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

mtz.d3m (move to zero) and vct.d3m (view center this)

Started by prl, April 07, 2014, 02:15:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prl

Reference;  (long thread warning - I'll summarize) = http://forum.designcad.com/index.php?topic=5500.msg37429#msg37429

In the topic, we mentioned moving things to the DesignCAD origin.  Also have the DesignCAD view center focused on your model.  Lar mentioned a couple of macros I could not find (svc and vfc) but I have similar version.   Anyway, here are a couple routines that may help. 

mtz.d3m - moves the selection to zero
vct.d3m - sets the view center at the selection geometric center and begins the view orbit command. Helps in busy drawings. You spin about your selection.


Edit: I need to make a comment about view centers.  I tend to use only one large maximized window in DesignCAD but if you use multiple tiled windows such as the standard 3d layout, each window will maintain its own view center.  It is possible to have the camera pointed towards the moon while your model is in front of you in the other views.  Telling DesignCAD to "fit to window" while your camera is pointing into distance space away from the model gets you nothing (literally).

Edit again:  I'm having one of those days where I fail to get to the point.    The vct.d3m routine works on whichever tiled window is active.




'Program: mtz.d3m (move to zero)

if sys(80)=0 then
  Message "Nothing selected. . . press any key to continue"
  END
end if

if sys(80) > 0 then
   Sys(1027) = 4 'Yes/No MessageBox style
   Message "This will move selection to 0,0,0 using primary handle. Do you wish to continue?"
   if sys(1028) = 7 then
      sys(80) = 0
      end
   end if
endif

>DragMove
{
<Pointxyz [0, 0, 0]
}

regen
End



------------------------------------------------------------------


' Program: vct.d3m (view center this)

sys(1116)=0

if sys(80)=0 then
  Message "Nothing selected. . . press any key to continue"
  END
end if

x =(sys(196)+sys(198))/2
y =(sys(197)+sys(199))/2
z =(sys(200)+sys(201))/2

>sethandle
{
<Type 0
<pointxyz [x,y,z]
}

>SetViewerPoints
{
<pointxyz [x,y,z]
}
sys(1)=0

>setview
{
}
end



samdavo

Thanks yet again prl -

two questions :-
1. Macro vct.d3m needs to have something selected.
And let's assume that is the best way for it to work.
 
Then would you agree that the best/only(?) way to select a POINT (as against an object) is presumably
a) to set a pointmark where you would like the view centre to be set; to select that, and then run the macro to set the view centre there;  or
b) to draw a sphere centred on the point, (being obviously symmetrical about the centre); again to select that, and then run the macro to set the view centre there 

Second question,
2. Best way to save script in a new macro?  And for it to open with spacebar command line.

I usually just go to an existing macro, open it with Notepad, delete everything, paste in the new program, and save as , eg   vct.d3m.   However lately I believe it saves as vct.d3m.txt,   and then it doesn't open with spacebar  ( although it can be accessed through Tools/Macro Execute ( or "%").

Sorry fairly trivial questions, but appreciate any assistance (yet again  :)  ).
cheers
sam

prl

Quote from: samdavo on April 08, 2014, 05:45:24 AM
two questions :-
Then would you agree that the best/only(?) way to select a POINT (as against an object) is presumably

If I wish to pick the point for the view center and orbit,  I use the vc.d3m version.  This one, (vct.d3m), is a variation of that one but it does set the orbit point automatically based on the selection set.  Did I answer your question?

As for the "saving".  That should work but yes the extension needs to be *.d3m.  Not sure why notepad is adding the extra *.txt.  You can use explorer and remove that part and you should be good to go.  vct.d3m, mtz.d3m   etc.   It is the *.d3m that DesignCAD is looking for on the command line.


Edit:

By the way, adding a point mark and selecting it and using vct.d3m is perfectly fine if you prefer that approach for a specific point.  I just never thought of it.

DrollTroll

If you're using Notepad (as opposed to PSPad, the *DrollTroll-Approved BasicCAD Editor*), change the "Save As Type" from "Text Documents" to "All Files". Then it will keep your specified .d3m extension. Unfortunately,  you must do this EVERY time you save...
25 years with DesignCAD

Dr PR

vc.d3m is great! It is how the rotate view functions should have worked in the first place. Just start the macro, gravity snap to any point in the drawing, and rotate the trackball (move the mouse) to orbit the view around the selected point.

Once I found the vc.d3m macro I assigned it to the "Y" key instead of the relatively useless "Set View by View Center" functions which always orbits around some point other than what I am interested in.

The only drawback to vc.d3m (and all macros) is that it cannot be used "within" another command operation. For example, if you are drawing a line and you use vc.d3m the line draw function terminates. In this case I use  the "Set View by Drawing Center" function, but it is a VERY poor substitute for vc.d3m.

We can only hope that the vc.d3m function is someday coded into DesignCAD so we can use it within other functions.

Phil
DesignCAD user since 1987

DrollTroll

prl, you do realize you can simply attach the macros to the post, right?
25 years with DesignCAD

prl

Quote from: DrollTroll on April 08, 2014, 09:27:35 AM
prl, you do realize you can simply attach the macros to the post, right?

Yes, thanks.  The forum versions I post have a few less lines than my hard copies.  I pull out lines for run "SendUpdateMsg.exe" and such and reminder/quirk notes to myself.  Reminders to self aren't always coherent.


Lar

Quote from: Dr PR on April 08, 2014, 09:11:13 AM
The only drawback to vc.d3m (and all macros) is that it cannot be used "within" another command operation.
Don't forget that while in a command you can use the built-in command to set a focal point to orbit around. It just requires extra work in that you have to press 2 more keys:
   1] Invoke the 'Set Viewer Points' command (the camera icon with the red x in the View toolbox) and snap a point on the vertex you want to orbit around...
   2 (extra action-1)] end the command by pressing enter, or click the middle mouse button (the full command uses 2 points)...
   3 (extra action-2)] press Y to orbit.

Lar

bdeck

prl,

vct.d3m is VERY slick. 

Eliminates one of the 2 biggest obstacles to working in 3D.

Amazing that so much could be done with so few lines of code.

bd


prl

bd,

Great.

Although I didn't mention this in the referenced thread at the top of this post (which is already overflowing with suggestions),  but when in 3d tiled mode and one of your windows gets confused (points at nothing, non-visible model), you can select any object in one of the other views, then make active the malfunctioning view, and run vct.d3m and it will retrieve that view.  Basically it fixes the view camera so it points at something (the selection).



Dr PR

I agree with bdeck, vct.d3m is nice. Maybe even better than vc.d3m, but I haven decided that yet!

When I am zoomed in on part of a large object I really don't want the view to spin around the object's center. The vc.d3m macro allows me to set the view center at exactly the point I am interested in viewing.

Phil
DesignCAD user since 1987

prl

Quote from: Dr PR on April 08, 2014, 11:51:50 AM
I agree with bdeck, vct.d3m is nice. Maybe even better than vc.d3m, but I haven decided that yet!

If you're working on a bolt, pretty handy. If you select a bunch of things, you'll get an averaged big blue bull'e eye handle location which will probably shift the drawing too much.  I have vc.d3m hotkeyed.  I use it more but there are times this comes in handy.  As in the case of retrieving wacko perspective views.

samdavo

ok  two more questions -

a) does vc do anything that vct doesn't?  thinking of the "rotate around the maypole" bit (or "may-point" I guess).

b) sorry, but I haven't loaded vc yet.  Anyone have a copy please ( and I will rename it, lol, because I keep vector converting everything :) )  I know it came up in another thread recently, but a quick search has failed to pick up the flightpath recorder ping.  (PS :(  fighting against the clock to find that "ping" off Perth at the moment - poor bugas - the world gets crazier and crazier.)
cheers

prl

Quote from: samdavo on April 08, 2014, 02:56:58 PM
a) does vc do anything that vct doesn't?  thinking of the "rotate around the maypole" bit (or "may-point" I guess).
b) sorry, but I haven't loaded vc yet.  Anyone have a copy please ( and I will rename it, lol, because I keep vector converting everything :) )  I know it came up in another

Sam, here is the link.  Rename it and decide.  I tend to use it more than vct.d3m.

http://forum.designcad.com/index.php?topic=1831.msg9435#msg9435

and in this post, apparently this is why it is hooked to the hotkey "Y" (in place of the standard set view command).  That's old me talking.

http://forum.designcad.com/index.php?topic=1832.msg9444#msg9444

bdeck

Whats truly amazing is how the simple combination of two commands into a single macro makes such a difference in user friendliness.  (both vc and vct)

Of course the first thing I did after copying the vct macro was replace the SetHandle function with:

>deselect
{
}

Might set a point at the Handle location as well, for future VC use.

I rarely play with 3d just because viewing is so cumbersome, but now I may start poking around.

If we're lucky, maybe you, Lar, and Phil will pop with some lighting macros.

bd