Author Topic: ArrowheadType and ArrowheadBlock; Why doesn't this work?  (Read 2204 times)

0 Members and 1 Guest are viewing this topic.

nivuahc

  • Guest
ArrowheadType and ArrowheadBlock; Why doesn't this work?
« on: January 19, 2010, 03:14:14 PM »
Code: [Select]
(setq *acad*      (vlax-get-acad-object)
      *doc*       (vla-get-activedocument *acad*)
      *DimStyles* (vla-get-dimstyles *doc*)
      NewDimStyle (vla-add *DimStyles* "TestDimStyle")
)

Code: [Select]
(vlax-put-property NewDimStyle 'Arrowhead1Type 4)
; error: ActiveX Server returned the error: unknown name: ARROWHEADTYPE

Code: [Select]
(vlax-put-property NewDimStyle 'Arrowhead1Type acArrowArchTick)
; error: ActiveX Server returned the error: unknown name: ARROWHEADTYPE

Code: [Select]
(vlax-put-property NewDimStyle 'Arrowhead1Type "acArrowArchTick")
; error: ActiveX Server returned the error: unknown name: ARROWHEADTYPE

Code: [Select]
(vlax-put-property NewDimStyle 'Arrowhead1Block "ArchTick")
; error: ActiveX Server returned the error: unknown name: ARROWHEADBLOCK


However...

Code: [Select]
IAcadDimRotated: AutoCAD Rotated Dimension Interface
; Property values:
;.... <snipped some other stuff>
;   AltUnitsFormat = 2
;   AltUnitsPrecision = 2
;   AltUnitsScale = 25.4
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00d591b4>
[color=red];   Arrowhead1Block = "ArchTick"
;   Arrowhead1Type = 4
;   Arrowhead2Block = "ArchTick"
;   Arrowhead2Type = 4[/color]

 :?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: ArrowheadType and ArrowheadBlock; Why doesn't this work?
« Reply #1 on: January 19, 2010, 03:24:22 PM »
They are the properties for a dimension - not a dimstyle.

I think you need to use the CopyFrom method to set a dimstyle, but I could be wrong  ;-)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ArrowheadType and ArrowheadBlock; Why doesn't this work?
« Reply #2 on: January 19, 2010, 03:26:11 PM »
Like Lee said, you have to change the dimension system variables, and the copy the dim style, with ActiveX.  I have not done it yet, but that is how I remember it being done.  A search here, or at Adesk, might turn something up more useful.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

nivuahc

  • Guest
Re: ArrowheadType and ArrowheadBlock; Why doesn't this work?
« Reply #3 on: January 25, 2010, 01:05:10 PM »
Seems to work like I expect it to... but, meh, I don't like it. I can't imagine why it has to be so complicated. If the text style doesn't exist, it creates it. If the block isn't defined in the drawing, it tries to find it, etc... phooey  :-(

Constructive criticism, slaps on the wrist, suggestions and ideas are all welcomed

Code: [Select]
(defun c:standarddims
       (/ *acad* *doc* *dims* StandardDimList DimData *TextStyles* NewStyle)
  (setq *acad* (vlax-get-acad-object)
        *doc*  (vla-get-activedocument *acad*)
        *dims* (vla-get-dimstyles *doc*)
  ) ;_ end setq
  (setq StandardDimList
         (list ;DimStyleName DIMTXSTY DIMFRAC DIMTIH DIMRND DIMTXT DIMTAD DIMSCALE DIMBLK DIMANNO
           '("DimStyle_1" "Standard" 0 1 0.125 0.1 1 1 "" "N")
           '("DimStyle_2" "Romans" 1 1 0.125 0.1 1 1 "" "Y")
           '("DimStyle_3" "Style_3" 2 1 1 0.1 1 1 "" "Y")
           '("DimStyle_4" "Style_4" 2 1 1 0.1 0 1 "Loop" "N")
           '("DimStyle_5" "Style_5" 2 1 1 0.125 1 48 "Slappy" "Y")
           '("DimStyle_6" "Style_6" 2 1 1 0.125 1 48 "_ArchTick" "Y")) ;_ end of list
  ) ;_ end setq StandardDimList
  (vla-setvariable *doc* "CMDECHO" 0)
  (vl-cmdf "-DIMSTYLE" "R" "Standard")
  (foreach DimData StandardDimList
    (vla-setvariable *doc* "DIMLUNIT" 4)          ; setup standard settings first
    (vla-setvariable *doc* "DIMAUNIT" 0)
    (vla-setvariable *doc* "DIMZIN" 3)
    (vla-setvariable *doc* "DIMASZ" 0.0625)
    (vla-setvariable *doc* "DIMEXE" 0.0625)
    (vla-setvariable *doc* "DIMEXO" 0.0625)
    (vla-setvariable *doc* "DIMGAP" 0.03125)
    (if (not (tblsearch "Style" (nth 1 DimData)))
      (progn
        (princ
          "\nSpecified text style not found, creating it with default settings"
        ) ;_ end of princ
        (setq *TextStyles* (vla-get-textstyles *doc*)
              NewStyle     (vla-add *TextStyles* (nth 1 DimData))
        ) ;_ end of setq
        (vla-put-height NewStyle 0.0)
        (vla-put-width NewStyle 0.85)
        (vla-put-fontfile NewStyle "Romans.shx")
        (vlax-release-object *TextStyles*)
      ) ;_ end progn
    ) ;_ end if
    (vla-setvariable *doc* "DIMTXSTY" (nth 1 DimData))
    (vla-setvariable *doc* "DIMFRAC" (nth 2 DimData))
    (vla-setvariable *doc* "DIMTIH" (nth 3 DimData))
    (vla-setvariable *doc* "DIMRND" (nth 4 DimData))
    (vla-setvariable *doc* "DIMTXT" (nth 5 DimData))
    (vla-setvariable *doc* "DIMTAD" (nth 6 DimData))
    (vla-setvariable *doc* "DIMSCALE" (nth 7 DimData))
    (if (not (member (strcase (nth 8 DimData))
                     '(""              "_DOT"          "_DOTSMALL"
                       "_DOTBLANK"     "_ORIGIN"       "_ORIGIN2"
                       "_OPEN"         "_OPEN90"       "_OPEN30"
                       "_CLOSED"       "_SMALL"        "_NONE"
                       "_OBLIQUE"      "_BOXFILLED"    "_BOXBLANK"
                       "_CLOSEDBLANK"  "_DATUMFILLED"  "_DATUMBLANK"
                       "_INTEGRAL"     "_ARCHTICK"
                      )
             ) ;_ end member
        ) ;_ end not
      (progn
        (if (not (tblsearch "Block" (nth 8 DimData)))
          (progn
            (princ "\nCan't find specified block... searching.... ")
            (if (not (findfile (strcat (nth 8 DimData) ".dwg")))
              (progn
                (princ "\nUnable to locate specified block, setting to default. "
                ) ;_ end of princ
                (vla-setvariable *doc* "DIMBLK" "")
              ) ;_ end progn
              (progn (vl-cmdf "-INSERT" (nth 8 DimData) "0,0" "" "" "")
                     (vl-cmdf "-erase" (entlast))
                     (vla-setvariable *doc* "DIMBLK" (nth 8 DimData))
              ) ;_ end progn
            ) ;_ end if
          ) ;_ end progn
          (vla-setvariable *doc* "DIMBLK" (nth 8 DimData))
        ) ;_ end if
      ) ;_ end progn
      (vla-setvariable *doc* "DIMBLK" (nth 8 DimData))
    ) ;_ end if
    (vla-copyfrom (vla-add *dims* (nth 0 DimData)) *doc*)
    (vl-cmdf "-DIMSTYLE"
             "AN"
             (nth 9 DimData)
             (nth 0 DimData)
             "Y"
             "R"
             "Standard"
    ) ;_ end of vl-cmdf
  ) ;_ end foreach
  (vla-setvariable *doc* "CMDECHO" 1)
  (vlax-release-object *dims*)
  (vlax-release-object *doc*)
  (vlax-release-object *acad*)
  (princ)
) ;_ end defun c:standarddims