ComboBox - Arrow Head

Started by dkh007, July 12, 2007, 05:11:54 PM

Previous topic - Next topic

dkh007

I'm exploring the Arrow Head drop down for a ComboBox. I can use (dcl_ComboBox_GetTBText) to get the text that is displayed. Is there another GET function that retrieves the BLOCK name used by AutoCAD for the DIMBLK (or DIMLDRBLK)? Example, Select from the ComboBox: Origin indicator (block name is "Origin") or Closed blank (block name "Closedblank").
Daniel Hargreaves, AIA, CSI, CDT, RAS
accustudio.com

Kerry

#1
Try these Daniel ..
....... though you may need to run them through a (strcase ... ) routine ...

""
closed filled

"_DOT"
dot

"_DOTSMALL"
dot small

"_DOTBLANK"
dot blank

"_ORIGIN"
origin indicator

"_ORIGIN2"
origin indicator 2

"_OPEN"
open

"_OPEN90"
right angle

"_OPEN30"
open 30

"_CLOSED"
closed

"_SMALL"
dot small blank

"_NONE"
none

"_OBLIQUE"
oblique

"_BOXFILLED"
box filled

"_BOXBLANK"
box

"_CLOSEDBLANK"
closed blank

"_DATUMFILLED"
datum triangle filled

"_DATUMBLANK"
datum triangle

"_INTEGRAL"
integral

"_ARCHTICK"
architectural tick

Perfection is not optional.
My other home is TheSwamp

Kerry

Daniel,

I have an old recollection that the blocks are not available until they are configured on a DIM style.
I seem to recall making a block with all the DIM blocks included when I was setting leader stuff pragmatically ... This functionality MAY have changed

/// kwb
Perfection is not optional.
My other home is TheSwamp

Kerry

How about something like  ..

;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
(SETQ ArrowBlockList '(("CLOSED FILLED" . "")
                       ("DOT" . "_DOT")
                       ("DOT SMALL" . "_DOTSMALL")
                       ("DOT BLANK" . "_DOTBLANK")
                       ("ORIGIN INDICATOR" . "_ORIGIN")
                       ("ORIGIN INDICATOR 2" . "_ORIGIN2")
                       ("OPEN" . "_OPEN")
                       ("RIGHT ANGLE" . "_OPEN90")
                       ("OPEN 30" . "_OPEN30")
                       ("CLOSED" . "_CLOSED")
                       ("DOT SMALL BLANK" . "_SMALL")
                       ("NONE" . "_NONE")
                       ("OBLIQUE" . "_OBLIQUE")
                       ("BOX FILLED" . "_BOXFILLED")
                       ("BOX" . "_BOXBLANK")
                       ("CLOSED BLANK" . "_CLOSEDBLANK")
                       ("DATUM TRIANGLE FILLED" . "_DATUMFILLED")
                       ("DATUM TRIANGLE" . "_DATUMBLANK")
                       ("INTEGRAL" . "_INTEGRAL")
                       ("ARCHITECTURAL TICK" . "_ARCHTICK")
                      )
)


(DEFUN c:Test_F_ComboBoxArrows_OnSelChanged (nSelection sSelText /)   
    (ALERT (CDR (ASSOC (STRCASE sSelText) ArrowBlockList)))
)
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
Perfection is not optional.
My other home is TheSwamp

dkh007

Thanks Kerry! That was going to be my next approach... I know over time Autodesk has change the "Arrow Head" and I was thinking with each change there was some logical way to call the block. For now, I will use this routine it is nice and simple.
Daniel Hargreaves, AIA, CSI, CDT, RAS
accustudio.com

Kerry

You're welcome Daniel.

I had considered using the nSelection integer

ie ( nth nSelection SimpleBlockList) but it's not as transparent to the coder as the sample posted (in my opinion, anyway)
Perfection is not optional.
My other home is TheSwamp

dkh007

I ended up storing the sSelText in the registry and then use the ASSOC to get it from the ArrowBlockList. And then the registry lets the user call the variable at later date. And your right, this method is MUCH easier to see (and add to in future versions of AutoCAD).


;;; Set Leader head
(defun c:Test_F_ComboBoxArrows_OnSelChanged (nSelection sSelText /)
  (vl-registry-write "HKEY_CURRENT_USER\\Software\\Product\\Version" "Leader Arrow" sSelText)
)

(setq ArrowBlock (CDR (ASSOC (STRCASE (vl-registry-read "HKEY_CURRENT_USER\\Software\\Product\\Version" "Leader Arrow")) ArrowBlockList)))

(setvar "DIMLDRBLK" ArrowBlock)

Daniel Hargreaves, AIA, CSI, CDT, RAS
accustudio.com

goodonline

I pilfered what kerry originally created and setup a function to retrieve the block name or the text for the block name.


;; function to get the block name of and arrowhead in both directions
;; supply the text string or the block name and it will give you the
;; opposing name

(defun c:ArrowNameConv (xname / vArrowBlockList vAns vCount vItem)
  (setq   vArrowBlockList
    '(("CLOSED FILLED" . "")
      ("DOT" . "_DOT")
      ("DOT SMALL" . "_DOTSMALL")
      ("DOT BLANK" . "_DOTBLANK")
      ("ORIGIN INDICATOR" . "_ORIGIN")
      ("ORIGIN INDICATOR 2" . "_ORIGIN2")
      ("OPEN" . "_OPEN")
      ("RIGHT ANGLE" . "_OPEN90")
      ("OPEN 30" . "_OPEN30")
      ("CLOSED" . "_CLOSED")
      ("DOT SMALL BLANK" . "_SMALL")
      ("NONE" . "_NONE")
      ("OBLIQUE" . "_OBLIQUE")
      ("BOX FILLED" . "_BOXFILLED")
      ("BOX" . "_BOXBLANK")
      ("CLOSED BLANK" . "_CLOSEDBLANK")
      ("DATUM TRIANGLE FILLED" . "_DATUMFILLED")
      ("DATUM TRIANGLE" . "_DATUMBLANK")
      ("INTEGRAL" . "_INTEGRAL")
      ("ARCHITECTURAL TICK" . "_ARCHTICK")
     )
  ) ;_ end setq

  (setq vCount 0)
  (setq vAns nil)

  (while (not vAns)

    (setq vItem (nth vCount vArrowBlockList))

    (cond
      ((= (strcase xname) (car vItem))
       (setq vAns (cdr vItem))
      )
      ((= (strcase xname) (cdr vItem))
       (setq vAns (car vItem))
      )
      (t nil)
    ) ;_end cond

    (if   (> vCount (length vArrowBlockList))
      (setq vAns (strcase xName))
    ) ;_ end of if


    (setq vCount (1+ vCount))
   

  ) ;_while

  vAns

) ;_end defun


Robert good