Author Topic: bent ! or what ?  (Read 2087 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
bent ! or what ?
« on: May 19, 2006, 11:35:29 PM »
Geeze I love my job !
Code: [Select]
(KB:ASSERT
    '(OR
      (VL-SYMBOL-VALUE 'GML:MTLColumnSetout)
      (AND       
       (OR (VL-SYMBOL-VALUE 'GML:MaterialConfig) (MATERIAL:INITIALISE))
       GML:MTLHeaderName
       (SETQ
        tmpTagList
        (_MATERIAL_column_Setout
         (SSGET "X" (LIST (CONS 0 "INSERT") (CONS 2 GML:MTLHeaderName)))
        )
       )
       (SETQ
        GML:MTLColumnSetout
        (MAPCAR '(LAMBDA (pair) (CONS (CAR pair) (READ (CDR pair)))) tmpTagList)
       )
      )
     )
    "Unable to Initialise Material Column Settings"
)
;;-----------------------------------------
(defun kb:assert (teststatement message)
  (if (not (eval teststatement))
    (progn (kb:display-message
             " **** Assertion Failure"
             (if message
               message
               (list (vl-prin1-to-string teststatement) " ==>> nil/null")
             )
           )
           ;; decide what to do here later ?
           (if KG:debug_on
             (princ "  ")
             (exit)
           )
    )
  )
  (princ)
)
;;-----------------------------------------
(defun kb:display-message (prefix mess)
  (mapcar 'princ
          (list "\n"
                (if (= (type prefix) 'str)
                  prefix
                  "; **** ERROR"
                )
                ": "
          )
  )
  (if (vl-consp mess)
    (mapcar 'princ mess)
    (princ mess)
  )
  (princ)
)
;;;----------------------------------------------------------------------------
 (DEFUN _MATERIAL_column_Setout (ss / obj)
     (IF (SETQ obj (SSNAME ss 0))
         (MAPCAR
             '(LAMBDA (att) (CONS (VLA-GET-TAGSTRING att) (VLA-GET-TEXTSTRING att)))
             (VLAX-INVOKE (VLAX-ENAME->VLA-OBJECT obj) 'getconstantattributes)
         )
     )
 )
;;;---------------------------------------------------------------------------- 
« Last Edit: May 20, 2006, 12:14:23 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: bent ! or what ?
« Reply #1 on: May 19, 2006, 11:48:34 PM »
The algorithm looked something like this { but scribbled on a couple of sheets of A4 paper }

Test  Global variable exists .. if so move along

else  do we know the block name
if not, initialise { read ini file based on project }

test if the header block exists,
if so read the hidden attributes into a pairs list
convert the string values in the pair list into reals.

If anything fails, skip out and go home.

Depending on the block , returns something like this :
(("QTY" . 37.5) ("REMARK" . 128.5) ("MASS" . 191.5) ("LENGTH" . 121.5) ("DESC" . 42.5) ("TAG" . 15))

which are X ordinates for placing MText in columns in a material List

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: bent ! or what ?
« Reply #2 on: May 20, 2006, 12:12:03 AM »
Geeze I love my job !
And quite good at too. 8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.