Author Topic: Diesel Expressions to evaluate two linear parameters  (Read 1662 times)

0 Members and 1 Guest are viewing this topic.

mbrandt5

  • Mosquito
  • Posts: 5
Diesel Expressions to evaluate two linear parameters
« on: October 01, 2015, 09:46:21 pm »
I'm looking to use a diesel expression to evaluate to linear parameters and display the greater of the two...

All I can come up with is this which, I'm certain is wrong...

$(eval, $(>, Distance1, Distance2))

Any pointers would be greatly appreciated :-)

mjfarrell

  • Seagull
  • Posts: 13920
  • Every Student their own Lesson
Re: Diesel Expressions to evaluate two linear parameters
« Reply #1 on: October 02, 2015, 09:45:36 am »
Interesting, however what is the end state desired?

Perhaps this 'evaluation' could be done some other way?
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Master_Shake

  • Swamp Rat
  • Posts: 1182
Re: Diesel Expressions to evaluate two linear parameters
« Reply #2 on: October 02, 2015, 10:15:33 am »
I'm looking to use a diesel expression to evaluate to linear parameters and display the greater of the two...

All I can come up with is this which, I'm certain is wrong...

$(eval, $(>, Distance1, Distance2))

Any pointers would be greatly appreciated :-)

Does it not work?

Lee Mac

  • Seagull
  • Posts: 11681
  • AutoCAD 2015 Windows 7 London, England
Re: Diesel Expressions to evaluate two linear parameters
« Reply #3 on: October 02, 2015, 10:31:37 am »
As far as I am aware, you cannot nest field expressions within a DIESEL expression, therefore, unless you assign the values of the linear parameters to user system variables, you will be unable to reference these values from within a DIESEL expression.

An alternative approach would be to use Formula Field (AcExpr), however, these do not support conditionals and there are no min/max formula functions.

Master_Shake

  • Swamp Rat
  • Posts: 1182
Re: Diesel Expressions to evaluate two linear parameters
« Reply #4 on: October 02, 2015, 10:49:55 am »
Does BricsCAD differ from AutoCAD in this regard?

Diesel functions can be nested, where the result of an inner function is passed as a parameter to the outer function:
$(fOuter$,$(fInner,param2,param3),param1)]

mbrandt5

  • Mosquito
  • Posts: 5
Re: Diesel Expressions to evaluate two linear parameters
« Reply #5 on: October 02, 2015, 10:53:11 am »
I would like it to work in a attdef on a dynamic block...

The end result is a attribute definition displaying the value of the greater of the two values

From what Lee Mac said its not possible to put fields value directly into a diesel expression

Another question if anyone knows, is can you use vlax in diesel expressions to bring in a parameters value?

One more is can you reference the parameters value with the lisp, then have that lisp value displayed within the Diesel expression?

Lee Mac also do you have any information on how to assign a system variable value to a fields value?



mjfarrell

  • Seagull
  • Posts: 13920
  • Every Student their own Lesson
Re: Diesel Expressions to evaluate two linear parameters
« Reply #6 on: October 02, 2015, 11:47:52 am »
I still don't get what you are after?

perhaps a picture would help...

if it is a distance value, why not use an invisible (vis state) element to get that distance...
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Lee Mac

  • Seagull
  • Posts: 11681
  • AutoCAD 2015 Windows 7 London, England
Re: Diesel Expressions to evaluate two linear parameters
« Reply #7 on: October 02, 2015, 12:34:29 pm »
Does BricsCAD differ from AutoCAD in this regard?

Diesel functions can be nested, where the result of an inner function is passed as a parameter to the outer function:
$(fOuter$,$(fInner,param2,param3),param1)]

DIESEL expressions can certainly be nested, but you cannot nest another Field expression (such as an Object Property field) within a DIESEL expression.

Another question if anyone knows, is can you use vlax in diesel expressions to bring in a parameters value?

No.

One more is can you reference the parameters value with the lisp, then have that lisp value displayed within the Diesel expression?

No.

Lee Mac also do you have any information on how to assign a system variable value to a fields value?

You can assign the system variable the [static] parameter value, but it will not update automatically - this requires an extension dictionary attached to the annotation object (text/mtext/attrib etc.).



You may be able to achieve this using a Lookup Table, but I haven't tried. Nope.
« Last Edit: October 02, 2015, 12:41:23 pm by Lee Mac »

mbrandt5

  • Mosquito
  • Posts: 5
Re: Diesel Expressions to evaluate two linear parameters
« Reply #8 on: October 14, 2015, 11:26:11 pm »
Code: [Select]
(defun get-or-make-Xrecord (/ anXrec)


;Defines mainDict
(Setq mainDict (namedobjdict))

;Defines Entity LineOne
;Not Sure How To Do This Assuming Handent DictSearch and NentSel
(Setq LineOne (...))

;Defines Entity LineTwo
;Not Sure How To Do This Assuming Handent DictSearch and NentSel
(Setq LineTwo (...))

;Defines LongestLine
(Setq longLine ((max ("LineOne" "LineTwo"))))


(setq mainDict (namedobjdict))

     (cond
 
       ;;if "OUR_DICT" is now valid then look for "OUR_VARS" Xrecord
       ((not (setq anXrec (dictsearch maindict "OUR_VARS")))
 
        ;;if "OUR_VARS" was not found then create it
;;NOT SURE HOW TO APPLY TEXT CHARACTERS
        (setq anXrec (entmakex '((0 . "XRECORD")
                                (100 . "AcDbXrecord")
                                (7 . "Arial")
                                (8 . "A09--T-")
                                (40 . 2.0)
                                (? . ?))
                     )
        )
 
        ;;if creation succeeded then add it to our dictionary
        (if anXrec (setq anXrec (dictadd maindict "OUR_VARS" anXrec)))
      )
 
       ;;if it's already present then just return its entity name
       (setq anXrec
 
        (cdr (assoc -1 (dictsearch maindict "OUR_VARS")))
       )
     )
)


;(defun c:subent ()
  (while   
     (setq Ent (entsel "\nPick an entity: "))
     (print (strcat "Entity handle is: "
          (cdr (assoc 5 (entget (car Ent))))))
   )
   (while   
      (setq Ent (nentsel "\nPick an entity or subEntity: "))
      (print (strcat "Entity or subEntity handle is:  "
          (cdr (assoc 5 (entget (car Ent))))))
   )
  (prompt "\nDone.")
 (princ)
)
;Returns Entity handle

;(handent "XXX") Returns entity name based on handle

I figured out sslength/getlength for determining lineone/linetwo. Still not sure how  to actually enter that information into the newly created xrecord as the entities variable...

Also I'm not sure if Max Function evaluate classes...

Any pointers, reference material, or help is greatly appreciated
« Last Edit: October 15, 2015, 07:43:08 am by mbrandt5 »