/* Lizp4 PhyzLib.lzp * * 2011-08-15 / Firma Stache: Added several new constants. * 2009-03-25 / Firma Stache: Added constants for Metaballic. * 2009-03-08 / Firma Stache: Support for registered indices added (PzReg* etc). * 2009-03-08 / Firma Stache: Added support for error return vals (ZWM_ERRVAL). * 2009-02-06 / Firma Stache: Function PzPaste updated to take x,y coordinates. * 2009-02-01 / Firma Stache: New constants and functions defined (SetChargeVal, SetHeatVal). * 2009-01-31 / Firma Stache: New constants defined (ZWM_GetBlackholes..ZWM_GetShowTextures, ZWM_SetBlackholes..ZWM_SetShowTextures). * 2009-01-15 / Firma Stache: New function PzStartApp. * 2009-01-05 / Firma Stache: Added support for new window msg (rigid precision). * 2008-06-16 / Firma Stache: New functions PzGetSpringCurLen, PzGetSpringForce. * 2008-06-16 / Firma Stache: Updated window msg constants. * 2008-06-16 / Firma Stache: Added support for new window msgs (grid, slowmotion, breakable). * 2008-05-31 / Firma Stache: First version. * * */ (seq (if (or (not (boundp 'StdLib)) (< StdLib 4.53)) (exception "*** PhyzLib requires StdLib version 4.53 or greater.") ) (defglobal PhyzLib 1.15) (display (mkstring "*** PhyzLib version " PhyzLib "%0d%0a")) (defglobal PHYZ nil) (defglobal P 0.008) (defglobal UNIT_SCALE 10) (defglobal ZWM_ERRVAL -2147483648) // All valid return vals are greater than this. (defglobal WM_APP (hex2dec "8000")) (defglobal ZWM_GetVertX (+ WM_APP 101)) (defglobal ZWM_GetVertY (+ WM_APP 102)) (defglobal ZWM_GetVertVX (+ WM_APP 103)) (defglobal ZWM_GetVertVY (+ WM_APP 104)) (defglobal ZWM_GetSpringCurLen (+ WM_APP 105)) (defglobal ZWM_GetSpringForce (+ WM_APP 106)) (defglobal ZWM_SetVertX (+ WM_APP 201)) (defglobal ZWM_SetVertY (+ WM_APP 202)) (defglobal ZWM_SetVertVX (+ WM_APP 203)) (defglobal ZWM_SetVertVY (+ WM_APP 204)) (defglobal ZWM_SetSpringLen (+ WM_APP 205)) (defglobal ZWM_SetSpringK (+ WM_APP 206)) (defglobal ZWM_SetSpringD (+ WM_APP 207)) (defglobal ZWM_SetSpringA (+ WM_APP 208)) (defglobal ZWM_SetSpringB (+ WM_APP 209)) (defglobal ZWM_SetRocketAngle (+ WM_APP 210)) (defglobal ZWM_SetRocketForce (+ WM_APP 211)) (defglobal ZWM_SetChargeVal (+ WM_APP 212)) (defglobal ZWM_SetHeatVal (+ WM_APP 213)) (defglobal ZWM_Copy (+ WM_APP 301)) (defglobal ZWM_Paste (+ WM_APP 302)) (defglobal ZWM_Open (+ WM_APP 303)) (defglobal ZWM_GetPhysics (+ WM_APP 401)) (defglobal ZWM_GetInfFrict (+ WM_APP 402)) (defglobal ZWM_GetGravity (+ WM_APP 403)) (defglobal ZWM_GetEarth (+ WM_APP 404)) (defglobal ZWM_GetFriction (+ WM_APP 405)) (defglobal ZWM_GetEdit (+ WM_APP 406)) (defglobal ZWM_GetShowGrid (+ WM_APP 407)) (defglobal ZWM_GetSlowmotion (+ WM_APP 408)) (defglobal ZWM_GetBreakable (+ WM_APP 409)) (defglobal ZWM_GetRigidprec (+ WM_APP 410)) (defglobal ZWM_GetBlackholes (+ WM_APP 411)) (defglobal ZWM_GetAccurate (+ WM_APP 412)) (defglobal ZWM_GetAdiabatics (+ WM_APP 413)) (defglobal ZWM_GetShowRods (+ WM_APP 414)) (defglobal ZWM_GetShowConstraints (+ WM_APP 415)) (defglobal ZWM_GetShowVerts (+ WM_APP 416)) (defglobal ZWM_GetMetaballic (+ WM_APP 417)) (defglobal ZWM_GetAutoJoin (+ WM_APP 418)) (defglobal ZWM_GetLow (+ WM_APP 419)) (defglobal ZWM_GetHigh (+ WM_APP 420)) (defglobal ZWM_GetSpeed (+ WM_APP 421)) (defglobal ZWM_GetDeterministic (+ WM_APP 422)) (defglobal ZWM_GetAutoRod (+ WM_APP 423)) (defglobal ZWM_GetSoundOn (+ WM_APP 424)) (defglobal ZWM_GetRecording (+ WM_APP 425)) (defglobal ZWM_GetRecWorkspace (+ WM_APP 426)) (defglobal ZWM_GetRecCursor (+ WM_APP 427)) (defglobal ZWM_GetRecBmp (+ WM_APP 428)) (defglobal ZWM_GetFramerate (+ WM_APP 429)) (defglobal ZWM_GetShowLogics (+ WM_APP 430)) (defglobal ZWM_GetShowSticks (+ WM_APP 431)) (defglobal ZWM_GetShowSprings (+ WM_APP 432)) (defglobal ZWM_GetShowLConns (+ WM_APP 433)) (defglobal ZWM_GetKbShorts1 (+ WM_APP 434)) (defglobal ZWM_GetKbShorts2 (+ WM_APP 435)) (defglobal ZWM_GetBLHalt (+ WM_APP 436)) (defglobal ZWM_GetFullscreen (+ WM_APP 437)) (defglobal ZWM_GetAutoSleep (+ WM_APP 438)) (defglobal ZWM_GetColourSleep (+ WM_APP 439)) (defglobal ZWM_SetPhysics (+ WM_APP 501)) (defglobal ZWM_SetInfFrict (+ WM_APP 502)) (defglobal ZWM_SetGravity (+ WM_APP 503)) (defglobal ZWM_SetEarth (+ WM_APP 504)) (defglobal ZWM_SetFriction (+ WM_APP 505)) (defglobal ZWM_SetEdit (+ WM_APP 506)) (defglobal ZWM_SetShowGrid (+ WM_APP 507)) (defglobal ZWM_SetSlowmotion (+ WM_APP 508)) (defglobal ZWM_SetBreakable (+ WM_APP 509)) (defglobal ZWM_SetRigidprec (+ WM_APP 510)) (defglobal ZWM_SetBlackholes (+ WM_APP 511)) (defglobal ZWM_SetAccurate (+ WM_APP 512)) (defglobal ZWM_SetAdiabatics (+ WM_APP 513)) (defglobal ZWM_SetShowRods (+ WM_APP 514)) (defglobal ZWM_SetShowConstraints (+ WM_APP 515)) (defglobal ZWM_SetShowVerts (+ WM_APP 516)) (defglobal ZWM_SetMetaballic (+ WM_APP 517)) (defglobal ZWM_SetAutoJoin (+ WM_APP 518)) (defglobal ZWM_SetLow (+ WM_APP 519)) (defglobal ZWM_SetHigh (+ WM_APP 520)) (defglobal ZWM_SetSpeed (+ WM_APP 521)) (defglobal ZWM_SetDeterministic (+ WM_APP 522)) (defglobal ZWM_SetAutoRod (+ WM_APP 523)) (defglobal ZWM_SetSoundOn (+ WM_APP 524)) (defglobal ZWM_SetRecording (+ WM_APP 525)) (defglobal ZWM_SetRecWorkspace (+ WM_APP 526)) (defglobal ZWM_SetRecCursor (+ WM_APP 527)) (defglobal ZWM_SetRecBmp (+ WM_APP 528)) (defglobal ZWM_SetFramerate (+ WM_APP 529)) (defglobal ZWM_SetShowLogics (+ WM_APP 530)) (defglobal ZWM_SetShowSticks (+ WM_APP 531)) (defglobal ZWM_SetShowSprings (+ WM_APP 532)) (defglobal ZWM_SetShowLConns (+ WM_APP 533)) (defglobal ZWM_SetShowAll (+ WM_APP 534)) (defglobal ZWM_SetShowNone (+ WM_APP 535)) (defglobal ZWM_SetKbShorts1 (+ WM_APP 536)) (defglobal ZWM_SetKbShorts2 (+ WM_APP 537)) (defglobal ZWM_SetBLHalt (+ WM_APP 538)) (defglobal ZWM_SetFullscreen (+ WM_APP 539)) (defglobal ZWM_SetAutoSleep (+ WM_APP 540)) (defglobal ZWM_SetColourSleep (+ WM_APP 541)) (defglobal ZWM_SetMode (+ WM_APP 542)) // wParam = mode (ID_B_*). (defglobal ZWM_SetShowTools (+ WM_APP 543)) (defglobal ZWM_SetShowOptions (+ WM_APP 544)) (defglobal ZWM_SetShowMenus (+ WM_APP 545)) (defglobal ZWM_RegVert (+ WM_APP 601)) (defglobal ZWM_RegRod (+ WM_APP 602)) (defglobal ZWM_RegStick (+ WM_APP 603)) (defglobal ZWM_RegSpring (+ WM_APP 604)) (defglobal ZWM_RegPin (+ WM_APP 605)) (defglobal ZWM_RegAnchor (+ WM_APP 606)) (defglobal ZWM_RegCharge (+ WM_APP 607)) (defglobal ZWM_RegHeat (+ WM_APP 608)) (defglobal ZWM_RegHSlot (+ WM_APP 609)) (defglobal ZWM_RegVSlot (+ WM_APP 610)) (defglobal ZWM_RegRocket (+ WM_APP 611)) (defglobal ZWM_RegObj (+ WM_APP 612)) (defglobal ZWM_RegReset (+ WM_APP 613)) (defglobal ZWM_RegVertGet (+ WM_APP 614)) (defglobal ZWM_RegRodGet (+ WM_APP 615)) (defglobal ZWM_RegStickGet (+ WM_APP 616)) (defglobal ZWM_RegSpringGet (+ WM_APP 617)) (defglobal ZWM_RegPinGet (+ WM_APP 618)) (defglobal ZWM_RegAnchorGet (+ WM_APP 619)) (defglobal ZWM_RegChargeGet (+ WM_APP 620)) (defglobal ZWM_RegHeatGet (+ WM_APP 621)) (defglobal ZWM_RegHSlotGet (+ WM_APP 622)) (defglobal ZWM_RegVSlotGet (+ WM_APP 623)) (defglobal ZWM_RegRocketGet (+ WM_APP 624)) (defglobal ZWM_RegObjGet (+ WM_APP 625)) (defglobal ZWM_RegLogic (+ WM_APP 626)) (defglobal ZWM_RegLogicGet (+ WM_APP 627)) // Modes. (defglobal ID_B_SELECT 110) (defglobal ID_B_SELVERT 111) (defglobal ID_B_ADDVERT 112) // v (defglobal ID_B_ADDROD 113) // r (defglobal ID_B_ADDSTICK 114) // s (defglobal ID_B_ADDANCHOR 115) // a (defglobal ID_B_ADDPIN 116) // p (defglobal ID_B_ADDSPRING 117) // S (defglobal ID_B_ADDHSLOT 118) // H (defglobal ID_B_ADDVSLOT 119) // V (defglobal ID_B_ADDROCKET 120) // R (defglobal ID_B_ADDRECT 121) (defglobal ID_B_ADDHRECT 122) (defglobal ID_B_ADDHOVAL 123) (defglobal ID_B_ADDHLINE 124) (defglobal ID_B_ADDCHARGE 125) // c (defglobal ID_B_ADDHEAT 126) // h (defglobal ID_B_ADDLOGIC 127) // l (defglobal ID_B_DRAW 128) (defglobal ID_B_SELDRAW 129) (defglobal ID_B_HDRAW 130) (defglobal ID_B_NONE 139) (defglobal (Sendmessage m w l) (define r (sendmessage PHYZ m w l)) (if r r 0) ) (defglobal (PzFindPhyz) (define ww (findwindow "*Dax Phyz" "DaxPhyzParent")) (if ww (seq (setq PHYZ (car ww)) (PzRegReset) ) ) ) (putval2 'PzFindPhyz "(PzFindPhyz) => Bok [PhyzLib]%0d%0a Tries to find a Phyz window, sets PHYZ to the window handle. Yields nil if no window can be found, PHYZ otherwise.") (defglobal (PzStartApp Sscene) (define phyz nil) (define n 10) (setq ERRHANDLER '(seq (msgbox "Error - PhyzLizp" (mkstring ERRSTR ":%0d%0a%0d%0a" ERRSTR2) nil 5) (quit))) (start (mkstring "Phyz.exe %22" (fgetpdir (fgetinvoke)) "\" Sscene ".pzs%22")) (while (and (>= (setq n (1- n)) 0) (not (setq phyz (PzFindPhyz)))) (sleep 0.5) ) (if (and phyz (sleep 0.5) (setq phyz (PzFindPhyz))) (seq (PzSetPhysics true) (feval (mkstring Sscene ".lzp")) ) (msgbox (mkstring Sscene " - PhyzLizp") "Unable to start Phyz." nil true) ) (quit) ) (putval2 'PzStartApp "(PzStartApp Sscene) => Bstarted [PhyzLib]%0d%0a Tries to start Phyz with scene Sscene.pzs, then evaluate script Sscene.lzp. in the current directory. Yields true if Phyz was started.") (defglobal (PzGetVertX V) (define r (Sendmessage ZWM_GetVertX V 0)) (if (> r ZWM_ERRVAL) (/ r 1000)) ) (putval2 'PzGetVertX "(PzGetVertX V) => Nx [PhyzLib]%0d%0a Yields the X coordinate of vertex V.") (defglobal (PzGetVertY V) (define r (Sendmessage ZWM_GetVertY V 0)) (if (> r ZWM_ERRVAL) (/ r 1000)) ) (putval2 'PzGetVertY "(PzGetVertY V) => Ny [PhyzLib]%0d%0a Yields the Y coordinate of vertex V.") (defglobal (PzGetVertVX V) (define r (Sendmessage ZWM_GetVertVX V 0)) (if (> r ZWM_ERRVAL) (/ r 1000)) ) (putval2 'PzGetVertVX "(PzGetVertVX V) => Nvx [PhyzLib]%0d%0a Yields the horizontal velocity of vertex V.") (defglobal (PzGetVertVY V) (define r (Sendmessage ZWM_GetVertVY V 0)) (if (> r ZWM_ERRVAL) (/ r 1000)) ) (putval2 'PzGetVertVY "(PzGetVertVY V) => Nvx [PhyzLib]%0d%0a Yields the vertical velocity of vertex V.") (defglobal (PzGetSpringCurLen S) (define r (Sendmessage ZWM_GetSpringCurLen S 0)) (if (> r ZWM_ERRVAL) (/ r 1000)) ) (putval2 'PzGetSpringCurLen "(PzGetSpringCurLen S) => Nlen [PhyzLib]%0d%0a Yields the current (actual) length of spring S.") (defglobal (PzGetSpringForce S) (define r (Sendmessage ZWM_GetSpringForce S 0)) (if (> r ZWM_ERRVAL) (/ r 1000)) ) (putval2 'PzGetSpringForce "(PzGetSpringForce S) => Nforce [PhyzLib]%0d%0a Yields the current force (F=-kx) exerted by spring S.") (defglobal (PzSetVertX V x) (define r (Sendmessage ZWM_SetVertX V (* x 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetVertX "(PzSetVertX V x) => Bok [PhyzLib]%0d%0a Sets the X coordinate of vertex V to x.") (defglobal (PzSetVertY V y) (define r (Sendmessage ZWM_SetVertY V (* y 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetVertY "(PzSetVertY V y) => Bok [PhyzLib]%0d%0a Sets the Y coordinate of vertex V to y.") (defglobal (PzSetVertVX V vx) (define r (Sendmessage ZWM_SetVertVX V (* vx 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetVertVX "(PzSetVertVX V vx) => Bok [PhyzLib]%0d%0a Sets the horizontal velocity of vertex V to vx.") (defglobal (PzSetVertVY V vy) (define r (Sendmessage ZWM_SetVertVY V (* vy 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetVertVY "(PzSetVertVY V vy) => Bok [PhyzLib]%0d%0a Sets the vertical velocity of vertex V to vy.") (defglobal (PzSetSpringLen S l) (define r (Sendmessage ZWM_SetSpringLen S (* l 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetSpringLen "(PzSetSpringLen S l) => Bok [PhyzLib]%0d%0a Sets the rest length of spring S to l.") (defglobal (PzSetSpringK S k) (define r (Sendmessage ZWM_SetSpringK S (* k 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetSpringK "(PzSetSpringK S k) => Bok [PhyzLib]%0d%0a Sets the k parameter of spring S.") (defglobal (PzSetSpringD S d) (define r (Sendmessage ZWM_SetSpringD S (* d 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetSpringD "(PzSetSpringD S d) => Bok [PhyzLib]%0d%0a Sets the d parameter of spring S.") (defglobal (PzSetSpringA S a) (define r (Sendmessage ZWM_SetSpringA S (* a 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetSpringA "(PzSetSpringA S a) => Bok [PhyzLib]%0d%0a Sets the a parameter of spring S.") (defglobal (PzSetSpringB S b) (define r (Sendmessage ZWM_SetSpringB S (* b 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetSpringB "(PzSetSpringB S b) => Bok [PhyzLib]%0d%0a Sets the b parameter of spring S.") (defglobal (PzSetRocketAngle R a) (define r (Sendmessage ZWM_SetRocketAngle R (* a 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetRocketAngle "(PzSetRocketAngle R a) => Bok [PhyzLib]%0d%0a Sets the angle of rocket R to a.") (defglobal (PzSetRocketForce R f) (define r (Sendmessage ZWM_SetRocketForce R (* f 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetRocketForce "(PzSetRocketForce R f) => Bok [PhyzLib]%0d%0a Sets the force of rocket R to f.") (defglobal (PzSetChargeVal C v) (define r (Sendmessage ZWM_SetChargeVal C (* v 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetChargeVal "(PzSetChargeVal C v) => Bok [PhyzLib]%0d%0a Sets the value of charge C to v.") (defglobal (PzSetHeatVal H v) (define r (Sendmessage ZWM_SetHeatVal H (* v 1000))) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetHeatVal "(PzSetHeatVal H v) => Bok [PhyzLib]%0d%0a Sets the value of heat H to v.") (defglobal (PzCopy) (define r (Sendmessage ZWM_Copy 0 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzCopy "(PzCopy) => Bok [PhyzLib]%0d%0a Copies the entire scene in Phyz to the clipboard as text. See the getclipboardtext function.") (defglobal (PzPaste x y) (define r (Sendmessage ZWM_Paste x y)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzPaste "(PzPaste x y) => Bok [PhyzLib]%0d%0a Parses the text content of the clipboard as a Phyz model or scene, and inserts the parsed items into the current scene at position x,y. See the setclipboardtext function.") (defglobal (PzGetPhysics) (<> (Sendmessage ZWM_GetPhysics 0 0) 0) ) (putval2 'PzGetPhysics "(PzGetPhysics) => Bon [PhyzLib]%0d%0a Yields non-nil if physics is enabled in Phyz; nil otherwise.") (defglobal (PzGetInfFrict) (<> (Sendmessage ZWM_GetInfFrict 0 0) 0) ) (putval2 'PzGetInfFrict "(PzGetInfFrict) => Bon [PhyzLib]%0d%0a Yields non-nil if infinite friction is enabled in Phyz; nil otherwise.") (defglobal (PzGetGravity) (<> (Sendmessage ZWM_GetGravity 0 0) 0) ) (putval2 'PzGetGravity "(PzGetGravity) => Bon [PhyzLib]%0d%0a Yields non-nil if gravity is enabled in Phyz; nil otherwise.") (defglobal (PzGetEarth) (<> (Sendmessage ZWM_GetEarth 0 0) 0) ) (putval2 'PzGetEarth "(PzGetEarth) => Bon [PhyzLib]%0d%0a Yields non-nil if earth is enabled in Phyz; nil otherwise.") (defglobal (PzGetFriction) (<> (Sendmessage ZWM_GetFriction 0 0) 0) ) (putval2 'PzGetFriction "(PzGetFriction) => Bon [PhyzLib]%0d%0a Yields non-nil if friction is enabled in Phyz; nil otherwise.") (defglobal (PzGetEdit) (<> (Sendmessage ZWM_GetEdit 0 0) 0) ) (putval2 'PzGetEdit "(PzGetEdit) => Bon [PhyzLib]%0d%0a Yields non-nil if edit mode is enabled in Phyz; nil otherwise.") (defglobal (PzGetShowGrid) (<> (Sendmessage ZWM_GetShowGrid 0 0) 0) ) (putval2 'PzGetShowGrid "(PzGetShowGrid) => Bon [PhyzLib]%0d%0a Yields non-nil if the grid is visible in Phyz; nil otherwise.") (defglobal (PzGetSlowmotion) (<> (Sendmessage ZWM_GetSlowmotion 0 0) 0) ) (putval2 'PzGetSlowmotion "(PzGetSlowmotion) => Bon [PhyzLib]%0d%0a Yields non-nil if slow-motion mode is enabled in Phyz; nil otherwise.") (defglobal (PzGetBreakable) (<> (Sendmessage ZWM_GetBreakable 0 0) 0) ) (putval2 'PzGetBreakable "(PzGetBreakable) => Bon [PhyzLib]%0d%0a Yields non-nil if constraints are breakable in Phyz; nil otherwise.") (defglobal (PzGetRigidprec) (<> (Sendmessage ZWM_GetRigidprec 0 0) 0) ) (putval2 'PzGetRigidprec "(PzGetRigidprec) => Bon [PhyzLib]%0d%0a Yields non-nil if ridig precision mode is enabled; nil otherwise.") (defglobal (PzSetPhysics B) (define r (Sendmessage ZWM_SetPhysics (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetPhysics "(PzSetPhysics Bon) => Bok [PhyzLib]%0d%0a Enables physics if Bon is non-nil; disables it otherwise.") (defglobal (PzSetInfFrict B) (define r (Sendmessage ZWM_SetInfFrict (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetInfFrict "(PzSetInfFrict Bon) => Bok [PhyzLib]%0d%0a Enables infinite friction if Bon is non-nil; disables it otherwise.") (defglobal (PzSetGravity B) (define r (Sendmessage ZWM_SetGravity (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetGravity "(PzSetGravity Bon) => Bok [PhyzLib]%0d%0a Enables gravity if Bon is non-nil; disables it otherwise.") (defglobal (PzSetEarth B) (define r (Sendmessage ZWM_SetEarth (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetEarth "(PzSetEarth Bon) => Bok [PhyzLib]%0d%0a Enables earth if Bon is non-nil; disables it otherwise.") (defglobal (PzSetFriction B) (define r (Sendmessage ZWM_SetFriction (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetFriction "(PzSetFriction Bon) => Bok [PhyzLib]%0d%0a Enables friction if Bon is non-nil; disables it otherwise.") (defglobal (PzSetEdit B) (define r (Sendmessage ZWM_SetEdit (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetEdit "(PzSetEdit Bon) => Bok [PhyzLib]%0d%0a Enables edit mode if Bon is non-nil; disables it otherwise.") (defglobal (PzSetShowGrid B) (define r (Sendmessage ZWM_SetShowGrid (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetShowGrid "(PzSetShowGrid Bon) => Bok [PhyzLib]%0d%0a Shows the Phyz grid if Bon is non-nil; hides it otherwise.") (defglobal (PzSetSlowmotion B) (define r (Sendmessage ZWM_SetSlowmotion (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetSlowmotion "(PzSetSlowmotion Bon) => Bok [PhyzLib]%0d%0a Enables slow-motion mode if Bon is non-nil; disables it otherwise.") (defglobal (PzSetBreakable B) (define r (Sendmessage ZWM_SetBreakable (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetBreakable "(PzSetBreakable Bon) => Bok [PhyzLib]%0d%0a Enables breakable constraints if Bon is non-nil; disables it otherwise.") (defglobal (PzSetRigidprec B) (define r (Sendmessage ZWM_SetRigidprec (if B 1 0) 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzSetRigidprec "(PzSetRigidprec Bon) => Bok [PhyzLib]%0d%0a Enables rigid precision mode if Bon is non-nil; disables it otherwise.") (defglobal (PzRegReset) (define r (Sendmessage ZWM_RegReset 0 0)) (if (> r ZWM_ERRVAL) r) ) (putval2 'PzRegReset "(PzRegReset) => Bok [PhyzLib]%0d%0a Clears all old registrations and registers all vertices and constraints with their current dynamic indices.") /* The macro mkRegCode yields constructs like the following (using Vert as example arg): (defglobal (PzRegVert Istat Idyn) (define r (Sendmessage ZWM_RegVert Istat Idyn)) (if (> r ZWM_ERRVAL) r) ) */ (defmacro mkRegCode (lambda (arg) (define Type (cadr arg)) `(seq (defglobal (,(mkatom 'PzReg Type) Istat Idyn) (define r (Sendmessage ,(mkatom 'ZWM_Reg Type) Istat Idyn)) (if (> r ZWM_ERRVAL) r) ) (putval2 ',(mkatom 'PzReg Type) (mkstring "(PzReg" ',Type " Istat Idyn) => Bok [PhyzLib]%0d%0a%0d%0a" "Registers the dynamic index Idyn with the static index Istat." ) ) (defglobal (,(mkatom 'PzReg Type 'Get) Istat) (define r (Sendmessage ,(mkatom 'ZWM_Reg Type 'Get) Istat)) (if (> r ZWM_ERRVAL) r) ) (putval2 ',(mkatom 'PzReg Type 'Get) (mkstring "(PzReg" ',Type "Get Istat) => Idyn [PhyzLib]%0d%0a%0d%0a" "Yields the dynamic index Idyn from the static index Istat." ) ) ) ) ) (mkRegCode Vert) (mkRegCode Rod) (mkRegCode Stick) (mkRegCode Spring) (mkRegCode Pin) (mkRegCode Anchor) (mkRegCode Charge) (mkRegCode Heat) (mkRegCode HSlot) (mkRegCode VSlot) (mkRegCode Rocket) (mkRegCode Obj) (display "%0d%0a%0d%0a") (display "Type (help 'pz*) and press Ctrl-Enter to list all Phyz specific funtions.%0d%0a") (display "Use (help 'functionName) to get specific help on a function.%0d%0a") (display "See http://phyz.ath.cx for examples and more information.%0d%0a") (display "%0d%0a%0d%0a") 'ok )