Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dimblk, dimblk1, dimblk2

3 views
Skip to first unread message

Robert Good

unread,
Jun 28, 2004, 6:41:51 PM6/28/04
to
In autocad 2004/2005 you cannot access the dimblk variables thru the namedobjtable. Instead Autodesk suggests accessing these variables thru objectid's

I am at a loss on how to access the objectid's without actually having to draw the dimension. I have tried to access the objectid's thru the dimstyle, but have not had any luck.

Please Help.

Robert Good.

Rudy Tovar

unread,
Jun 29, 2004, 12:34:58 PM6/29/04
to
As I mentioned before, you have to use activex.

Make the style current, then use vla functions to retrieve the variables.

Future dxf codes will be eliminated, and only be accessible through activex.
--
Ru...@Cadentity.com
AUTODESK
Authorized Developer
http://www.Cadentity.com
MASi


"Robert Good" <nos...@address.withheld> wrote in message
news:6955233.1088462541340.JavaMail.jive@jiveforum1...

Robert Good

unread,
Jun 29, 2004, 4:49:14 PM6/29/04
to
Rudy,
My goal here is to get the variables of a child dimension style, which may
be different than the current dimstyle setting.

Lets say you have arch tics for your dimblk settings on linear dimensions,
but want arrow heads on angular dimensions.

This is a very pertinant question, considering there will be no access to
these dxf values in the future.

Robert Good.


"Rudy Tovar" <Ru...@cadentitynospam.com> wrote in message
news:40e19a32$1_1@newsprd01...

Rudy Tovar

unread,
Jun 30, 2004, 12:44:15 PM6/30/04
to
Then vla make the object and feed the variables on how it's to appear.

In other words, write a utility to place said dimension style, while you
define how that object is suppose to appear.

Or create a reactor to monitor which command is issued, and have it set and
make the style current with the proper settings.

"Robert Good" <mai...@good-online.com> wrote in message
news:40e1d568$1_1@newsprd01...

RobertGood

unread,
Jul 1, 2004, 1:41:50 PM7/1/04
to
To add to my previous question. I am writing a utility that can export dimension settings to an external text file. (The express tools dim export utility is what I am trying to achieve.)
The only think I am not able to access is the dmblk variables of children dimstyles.

If the dim export utility can accomplish this task, it must be possible.

(should I be asking the objectARX Group instead??)

Robert Good.

Mark Propst

unread,
Jul 2, 2004, 2:43:37 AM7/2/04
to

"RobertGood" <nos...@address.withheld> wrote in message
news:16452365.1088703741121.JavaMail.javamailuser@localhost...

If you know arx, I'm sure there'd be a way to do that, and if you have an
arx question, I'm sure they'd be happy to try and answer it.
Since this is in the lisp group, I'd just say, I don't know of a way through
lisp or vb via activex to get at properties of a dimension style without
querying an instance of an object of that type. ie yes, you have to 'draw' a
dimension which would have the style in which you are interested, then
'read' the object to see what his 'properties' are.
So if you wanted to know the name of the dimension block used for a radial
dimension of style "Dim1"
you could create a dimradial object, set it's stylename property to "Dim1",
then read it's properties, like ArrowheadBlock, ArrowheadType,
ArrowheadSize.
eg: to list all blocknames for all radial children styles in oDoc

;excerpt from cond statement
((= childcode "$4");isolate radial child styles
;assuming functions that return the model space object and the active
document
;assuming valid vals for p1 p2 obviously
(setq testdim(vla-adddimradial(GetModelSpace(GetActiveDoc))p1 p2 10))
;assuming a subfunc that returns all dimstyle names
(foreach ds(GetDimstyles oDoc)
(vlax-put-property testdim 'stylename ds) ;set the style
;read properties and print out
(princ(strcat"\nArrowheadBlock for style: " ds " "(vlax-get-property
testdim 'ArrowheadBlock)))
(princ(strcat"\nArrowheadSize for style: " ds "
"(rtos(vlax-get-property testdim 'ArrowheadSize))))
(princ(strcat"\nArrowheadType for style: " ds "
"(itoa(vlax-get-property testdim 'ArrowheadType))))
);for
)
;;then delete test dim and release variable if need be
course if it's the default arrowhead block, the name will be "" even if it's
really "ClosedFilled"
and you'd create one with "." i think...?

maybe someone knows an easier way? i don't.
hth
Mark


Steve Doman

unread,
Jul 2, 2004, 8:48:50 AM7/2/04
to
Robert,

Have you tried iterating through each Dimstyle and setting any
childstyles active via the Dimstyle command, then reading the dimvars?

Not sure if the snip below helps:

(setq dimstyle (list "standard$0" "standard$7")) ;etc.
(setq varlist (list "dimblk" "dimblk1" "dimblk2"))

(foreach child dimstyle
(command "dimstyle" "restore" child)
(foreach var varlist
(do_something_with var)
)
)

Steve Doman

Robert Good

unread,
Jul 2, 2004, 7:41:58 PM7/2/04
to
thanks for the response mark.

For some unknown reason, in my minds eye. Creating a dimension to get the variables instead of pulling it from the drawing database seems backwards and cumbersome.
But, as we both know, to get the job done you have to do anything you can.
Ill ask around on the objectarx threads. If I dont get what I want there, I will have to break down and actually draw the dims and get the variables.

Thanks Again,
Rob.

Robert Good

unread,
Jul 2, 2004, 7:44:16 PM7/2/04
to
Steve,

To my knowledge, It is not possible to set a child dimension style current. (please correct me if I'm wrong)

Thanks for the reply.

Rob.

Steve Doman

unread,
Jul 5, 2004, 10:21:28 AM7/5/04
to
Robert,

I'm no expert at dimstyles but did you try setting a child dimstyle
active to see what happens? I hadn't tried it for a while myself and
your reply made me curious to see if it was no longer possible.

Prior to AutoCAD2k I now recall, the ability to set a child dimstyle
active was very straight forward -- (command "-dimstyle" "restore"
"Test$7" ...)

Anyhow while experimenting with the modern version of the Dimstyle
command (I'm testing on A2k5), it *appears* that you can set a parent
dimstyle active, but not a child style.

However if you run the Dimstyle command and tell it to restore a child
style and then examine the dimvars afterwards, you'll see that the child
dimvars are accessible.

So perhaps using the Dimstyle command to set a child style active is a
kludge, seeing how AutoCAD seems to be trying to prevent the user to
doing that. It does appear to work, but maybe there are some pitfalls
with this method that I'm not aware of.

Here's a command log using the Dimstyle command where I "restore" a
child dimstyle. In this example, the parent dimstyle has DimClrd var
set to zero, while the child style is set to 8:

Command: (getvar "dimstyle")
"TEST"

Command: (getvar "dimclrd")
0

Command: -dimstyle

Current dimension style: TEST
Enter a dimension style option
[Save/Restore/STatus/Variables/Apply/?] <Restore>: restore

Enter a dimension style name, [?] or <select dimension>: test$7

Current dimension style: TEST
Current dimension overrides:
DIMCLRD 8

Command: (getvar "dimclrd")
8

* Also as a footnote, ActiveX seems to work too:

(vla-put-activedimstyle
*doc*
(vla-item dimstyles "TEST$7")
)

HTH

Regards,
Steve Doman

Steve Doman

unread,
Jul 6, 2004, 12:51:45 AM7/6/04
to

Robert et al,

Here's what I came up with so far. It's a work in progress and not
tested much.

Let me know if it works for you please.

Regards,
Steve Doman

[code]
(defun GetDimvars (parent / doc saved collection pat name namelist var
varlist val rslt lst pat
)
;;
;; Steve Doman 07-05-04 beta
;;
;; Given a parent dimstyle name, returns a list of dimvars
;; for each child style in the dimension style family
;; (getdimvars "standard") -> (("STANDARD" ("dimadec" . 0) ... ))
;;
(setq parent (strcase parent))
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq saved (vla-get-activedimstyle doc))
(setq collection (vla-get-dimstyles doc))
(setq pat (strcat parent "," parent "$[023467]")) ;_ for wcmatch
;; The following list of dimvars may need to be adjusted cause
;; I haven't checked them over yet.
(setq varlist (list "dimadec" "dimalt" "dimaltd" "dimaltf"
"dimaltrnd" "dimalttd" "dimalttz" "dimaltu"
"dimaltz" "dimapost" "dimaso" "dimassoc"
"dimasz" "dimatfit" "dimaunit" "dimazin"
"dimblk" "dimblk1" "dimblk2" "dimcen" "dimclrd"
"dimclre" "dimclrt" "dimdec" "dimdle" "dimdli"
"dimdsep" "dimexe" "dimexo" "dimfit" "dimfrac"
"dimgap" "dimjust" "dimldrblk" "dimlfac"
"dimlim" "dimlunit" "dimlwd" "dimlwe" "dimpost"
"dimrnd" "dimsah" "dimscale" "dimsd1" "dimsd2"
"dimse1" "dimse2" "dimsho" "dimsoxd" "dimtad"
"dimtdec" "dimtfac" "dimtih" "dimtix" "dimtm"
"dimtmove" "dimtofl" "dimtoh" "dimtol" "dimtolj"
"dimtp" "dimtsz" "dimtvp" "dimtxsty" "dimtxt"
"dimtzin" "dimunit" "dimupt" "dimzin"
)
)
;; Make a list of each child style in dimstyle family
(vlax-for itm collection
(setq name (strcase (vla-get-name itm)))
(if (wcmatch name pat)
(setq namelist (cons name namelist))
)
)
;; Set each child style active and collect dimvars
(foreach name (reverse namelist)
(vla-put-activedimstyle doc (vla-item collection name))
(foreach var varlist
(setq val (getvar var))
;;(cond ((and (= (type val) 'STR) (= val "")) (setq val ".")))
(setq lst (cons (cons var val) lst))
)
(setq rslt (cons (cons name (reverse lst)) rslt))
(setq lst nil)
)
;; restore active dimstyle
(vla-put-activedimstyle doc saved)
(reverse rslt)
)
[/code]

RobertGood

unread,
Jul 6, 2004, 6:30:35 AM7/6/04
to
Steve,
I looked at your routine and put it thru a test on a dimstyle with children styles. It did give the variables for each child style. Awesome.
I was under the preconceived notion that we were not able to set the child dimstyles current and did not even try to test that statement.
Thanks Steve,
I will continue to study your clip and post back any further findings I have.

Thanks again,

Robert Good.

Steve Doman

unread,
Jul 6, 2004, 1:08:50 PM7/6/04
to

Hi Robert,

Glad it worked for you. I'm testing on A2k5 if that matters. There may
be some dimvars compared to earlier versions of AutoCAD.

One side effect I just noticed when after running the GetDimvar function
is when it restores the dimstyle that was active at runtime, any
pre-existing dim var overrides are wiped out :( In other words, if you
had say dimscale set to 96 as an override, then after the GetDimvar
function runs, the dimscale is reset to whatever is defined as dimscale
in the dimstyle (probably 0 or 1).

Not sure what to do about that if anything. Any comments or ideas?

Thanks,
Steve Doman

rgood

unread,
Jul 7, 2004, 6:25:21 AM7/7/04
to
Steve,
I am also testing your routine on 2005. I took out two dimvar's due to them being obsolete in 2004 and 2005.

DIMUNIT (obsolete, now use DIMLUNIT AND DIMFRAC)
DIMFIT (obsolete, now use DIMATFIT and DIMTMOVE)

I am currently having problems with my current dimension creation routine crashing autocad speratically. I'm hoping taking those variables out of the equation might help.

I am using your clip to export all the settings to a text file that can be imported on the fly to create a dimstyle when needed.
I will write back when I can post something worthy.

Robert Good

Steve Doman

unread,
Jul 8, 2004, 1:01:23 PM7/8/04
to

Robert,

Thanks for the heads up on the dimvars. Interestingly I created the
dimvar list by copy pasting the results from using the Set command in
A2k5. Apparently the obsolete dimvars are still present for backward
compatibility.

I look forward to seeing what you come up with for exporting and
importing since AutoCAD seems to no longer contain a DimIm or DimEx in
the Express Tools.

If you need any more help, I'll be glad to assist if I can.

Regards,
Steve Doman

rgood

unread,
Jul 14, 2004, 2:19:44 PM7/14/04
to
Steve,

Here goes. Please be gentle on my coding techniques. It may not be pretty, but she works.

I got the routine to export to a hard coded text file. It also looks for any user defined blocks as arrow heads and adds them to the beginning of the export file.


;| Steve Doman 07-05-04 beta


Given a parent dimstyle name, returns a list of dimvars
for each child style in the dimension style family

Modified by Robert Good
- added dialog interface for selecting dimstyle to export
- added functionality to export parent and child dimstyle settings to a text file.

|;


(defun ExportDim ( / thedimstyles theList acadDocument dat Dimsel saved collection pat name namelist arrowlist var varlist val fp)
(vl-load-com)
(setq theList '()
acadDocument (vla-get-activedocument (vlax-get-acad-object))
thedimstyles (vla-get-dimstyles acadDocument)
saved (vla-get-activedimstyle acadDocument)
collection (vla-get-dimstyles acadDocument)
) ;_ end of setq

;;Create list with only dimstyle names without the $ sign
(vlax-for item thedimstyles
(if (not (vl-string-search "$" (vla-get-name item))) ;_verifies no $ in dimstyle name
(setq theList (append theList (list (vla-get-name item))));_ add to list
) ;_end if
) ;_end vlax-for


;; Here we open a dialog box so the user can select the dimstyle
;; they want to save to an external file

(setq dat (load_dialog "LandQ.dcl"))
(if (not (new_dialog "SelectDimStyle" dat))
(exit)
) ;_ end of if

(action_tile "DimPop" "(setq DimSel $value)")
(action_tile "accept" "(done_dialog 1)")

(start_list "DimPop" 1)
(mapcar 'add_list theList)
(end_list)

(start_dialog)
(unload_dialog dat)


(setq parent (strcase (nth (atoi DimSel) theList)))



(setq pat (strcat parent "," parent "$[023467]")) ;_ for wcmatch

;; Make a list of each child style in dimstyle family


(vlax-for itm collection
(setq name (strcase (vla-get-name itm)))
(if (wcmatch name pat)(setq namelist (cons name namelist)))

) ;_ end of vlax-for


;; The following list of dimvars may need to be adjusted cause
;; I haven't checked them over yet.

(setq varlist (list "DIMADEC" "DIMALT" "DIMALTD" "DIMALTF" "DIMALTRND"
"DIMALTTD" "DIMALTTZ" "DIMALTU" "DIMALTZ" "DIMAPOST"
"DIMASO" "DIMASSOC" "DIMASZ" "DIMATFIT" "DIMAUNIT"
"DIMAZIN" "DIMBLK" "DIMBLK1" "DIMBLK2" "DIMCEN"
"DIMCLRD" "DIMCLRE" "DIMCLRT" "DIMDEC" "DIMDLE"
"DIMDLI" "DIMDSEP" "DIMEXE" "DIMEXO" "DIMFRAC"
"DIMGAP" "DIMJUST" "DIMLDRBLK" "DIMLFAC" "DIMLIM"
"DIMLUNIT" "DIMLWD" "DIMLWE" "DIMPOST" "DIMRND"
"DIMSAH" "DIMSCALE" "DIMSD1" "DIMSD2" "DIMSE1"
"DIMSE2" "DIMSHO" "DIMSOXD" "DIMTAD" "DIMTDEC"
"DIMTFAC" "DIMTIH" "DIMTIX" "DIMTM" "DIMTMOVE"
"DIMTOFL" "DIMTOH" "DIMTOL" "DIMTOLJ" "DIMTP"
"DIMTSZ" "DIMTVP" "DIMTXSTY" "DIMTXT" "DIMTZIN"
"DIMUPT" "DIMZIN"
) ;_ end of list
) ;_ end of setq

(setq arrowList (list "" "." "ArchTick" "ClosedBlank" "Closed" "Dot"
"Oblique" "Open" "Origin" "Origin2" "Open90"
"Open30" "DotSmall" "DotBlank" "Small" "BoxBlank"
"BoxFilled" "DatumBlank" "DatumFilled" "Integral" "None"
) ;_ end of list
) ;_ end of setq


;; Set each child style active and collect dimvars

(setq fp (open "d:\\dwg\\support\\lisp\\tempsettings.txt" "w"));_open file for writing

(foreach name (reverse namelist)
(vla-put-activedimstyle acadDocument (vla-item collection name))

;;here we write dimstyle header suffix information to file
(write-line (strcat "**" name) fp)


(foreach var varlist
(setq val (getvar var))

;;here lets test for dimblk, dimblk1, dimblk2 and dimldrblk, if not standard autocad symbols
;;we need to save to and list to write to an external file which we will merge with the dimsettings text file
(if (or (= var "DIMBLK")
(= var "DIMBLK1")
(= var "DIMBLK2")
(= var "DIMLDRBLK")
) ;_End Or
(if (and (not (member val arrowlist))
(not (member val userArrows))
);_end and
(setq userArrows (append userArrows (list val)))
) ;_end if
) ;_ end of if

(if (and (= (type val) 'STR) (= val ""))(setq val ".")) ;_ if string is empty, add dot.
(write-line (vl-prin1-to-string (cons var val)) fp) ;_write to file
) ;_ end of foreach
) ;_ end of foreach

(close fp) ;_close text file

;;write user arrows to an external file and merge with dimstyle text file
(if userArrows
(progn
(setq fp (open "d:\\dwg\\support\\lisp\\dimsettings.txt" "w")
) ;_open file for writing
(write-line (strcat "***" (vl-prin1-to-string userarrows)) fp)
(close fp) ;_close text file
(vl-file-copy ;_copy temp dim settings to final file
"d:\\dwg\\support\\lisp\\tempsettings.txt"
"d:\\dwg\\support\\lisp\\dimsettings.txt"
T
) ;_ end of vl-file-copy
(vl-file-delete "d:\\dwg\\support\\lisp\\landq routines\\tempsettings.txt") ; _ delete temp file

) ;_end progn
) ;_end if

;; restore active dimstyle
(vla-put-activedimstyle acadDocument saved)

) ;_ end of defun


Robert Good

Steve Doman

unread,
Jul 15, 2004, 8:36:02 AM7/15/04
to

Nice work Robert!

Your coding techniques look fine. I appreciate that you have my name in
the credits, but it's more your routine than mine. If you post the DCL
file, I (we) can actually run the code. :)

Regards,
Steve Doman

rgood wrote:
> Steve,
>
> Here goes. Please be gentle on my coding techniques. It may not be pretty, but she works.
>
> I got the routine to export to a hard coded text file. It also looks for any user defined blocks as arrow heads and adds them to the beginning of the export file.
>

<clip>

rgood

unread,
Jul 15, 2004, 9:18:17 AM7/15/04
to
Here is the dcl snip. Again Its not pretty. I need to spend some time beautifying the interface.

SelectDimStyle : dialog {
label = "Dimension Style Selection";
: text {
label = "Select the Dimension Style";
alignment = centered;
}
: row {
: popup_list {
key = "DimPop";
width = 10;
//alignment = centered;
//value = "0";
}
}
spacer;
ok_only;
}

}

Robert Good.

GaryDF

unread,
Jul 15, 2004, 10:07:56 AM7/15/04
to
You had one too many }
Also a list box would be easier to read.

SelectDimStyle : dialog {label = " Dimension Style Selection";
:text {label = "Select the Dimension Style"; alignment = centered;}
:row {

:list_box {key = "DimPop"; width = 10;}
}
spacer;
ok_only;
}

Gary

"rgood" <nos...@address.withheld> wrote in message
news:12966945.108989752...@jiveforum2.autodesk.com...

Steve Doman

unread,
Jul 16, 2004, 8:31:46 AM7/16/04
to
Robert,

Got it rolling! Had to delete the last curly brace in the DCL code
posted, as Gary noted. Also had to change the output filename path to
something local like "c:\\".

I'm curious as to what your are doing with those Dimblk vars. I see
that your code appends a list of user defined dimblks to the end of the
output file. My guess is that later, during the importing of dimstyles
into a drawing, you are inserting the blocks if they are not defined.

Thanks,
Steve Doman

rgood

unread,
Jul 16, 2004, 8:02:03 PM7/16/04
to
Steve,
Yes, I pulled the names of any user defined blocks. That way on dimension creation, I can test to see if the block is in the drawing and if not, import into drawing.

I was tinkering with the dimexport routine this afternoon and realized it has no options for fonts that are in the dimstyle. I have a preliminary setup for reading the font name and getting the font file name associated with it. I will post this when I get it tweaked a bit more.

Im on vacation this week so it might be a while. spending a bit of time in the nations capitol.

Robert Good.
www.good-online.com

0 new messages