No clue?

Rudy Tovar

Usenet Archive
Joined
Jul 8, 2003
Messages
631
Reaction score
0
I take it that no one knew the answer to my question below "Document or Object" 2/2/2004 2:17pm.

So I'll either have to assume I was right, but just the same I'll do some more testing.
 
Rudy,
I didn't know specifically what you were talking about so didn't comment. If you could be more specific, I would be glad to make a response.

In the case of a dimstyle, I have used setvar statements to establish the mix of dimension settings I desired and then used "dim1" "save" ... to store them in a specific style. I've never tried to use entmake for dimstyles so can't comment.

Regards,
Doug
 
I'm using activex and vla functions to create the dimstyle.

I've decided to rewrite everything to pure VL functions including the line, dimension, style, and block etc. creation.

I should have done this 5 years ago when I first purchased VLISP from autodesk for R14. I was so used to writing everything in 'entmake' that I just held back. I understand VLA functions considerably, but either you do pure or not.

My question was in regards to creating a dimstyle which I've not had any problems with. And although I've not taken the time to study it closely, it seems to me currently, that to change a dimstyle property would require for it to be the current dimstyle, then editing the settings, like assigning blocks and dimscale, etc. If I expose the values of a named dimstyle, it does not reveal any of it's values, dimzin,dimblk1, etc. Excuse if I've miss typed any of the variables.

Or did I miss a step by not completely reveal all the exposed dimstyle variable settings?

I'm just trying to make it easier to manipulate create and execution of objects.
 
Rudy,
I don't think you're missing anything (of all people you'd hardly be the one to miss something) It's the dimensionstyle object thats missing something(like all the properties it should have)

(dump(vlax-get-property *doc* 'activedimstyle))

; IAcadDimStyle: A group of dimension settings that determines the appearance of a dimension ; Property values:
; Application (RO) = #<VLA-OBJECT IAcadApplication 00a8a730> ; Document (RO) = #<VLA-OBJECT IAcadDocument 00f4e7dc> ; Handle (RO) = "447" ; HasExtensionDictionary (RO) = 0 ; Name = "Ptsg_48_PS" ; ObjectID (RO) = 1074448248 ; ObjectName (RO) = "AcDbDimStyleTableRecord" ; OwnerID (RO) = 1074441296 ; Methods supported:
; CopyFrom (1)
; Delete
; GetExtensionDictionary
; GetXData (3)
; SetXData (2)

;that's all you get....basically just the name

You don't have to set it current to set it's properties but the only way I know to change it is set the dimstyle system variables in the document, then use the .CopyFrom method to put those properties in your desired dimensionStyle object

consider the following test:
(setq dsobj(GetDimstyles *doc*));get dimstyles collection ;#<VLA-OBJECT IAcadDimStyles 04448344> (setq newds(vlax-invoke-method dsobj 'add "test"));add a new member ;#<VLA-OBJECT IAcadDimStyle 090557e4>

;set current style to newly added "test" style
;create a dim and dump object
; IAcadDimRotated: AutoCAD Rotated Dimension Interface
; Property values:
;<snip>
; ScaleFactor = 1.0
; StyleName = "test"
;<snip>

;change active dimstyle to another style
;read style to confirm
(vlax-invoke-method *doc* 'getvariable "dimstyle")
;#<variant 8 Ptsg_8_MS>

;change dimscale
(vlax-invoke-method *doc* 'setvariable "dimscale" 100)
;nil

;copy variable to dimstyle object(note it is not current at this point) (vlax-invoke-method newds 'CopyFrom
*doc*
)
;nil

;reset dimstyle to "test"
;create new dim and dump
; IAcadDimRotated: AutoCAD Rotated Dimension Interface
; Property values:
;<snip>
; ScaleFactor = 100.0
; StyleName = "test"

The only way I know of to read the properties of a DimensionStyle (that is the properties that *should* belong to a Dimstyle object but which unfortunately don't) is to read the properties of a Dimension object which has that Style as it's StyleName property.

The way autocad implements "object oriented programming" seems a bit inconsistent, depending on the objects involved.
 
So what you're say is the same as I'm implying?

The dimstyle has to be current, then you assign the variable values to the current doc dimstyle?
 
Rudy,
The process of creating a new dimstyle via activeX is a bit indirect but far simpler than it would have been had they made every property available in the dimstyle itself. The copyfrom method is the key.

;;Given:
;;get a document object(could be another document)
(setq doc (vla-get-activedocument(vlax-get-acad-object))) ;;get activedimstyle is it is to be changed or used as a pattern (setq activedstyle (vla-get-activedimstyle doc)) ;;get dimstyle collection (if adding a style) (setq dimstyles (vla-get-dimstyles doc)) ;;example of adding a dimension override to a document (vla-setvariable doc "dimasz" 0.25) ;;example of adding a dimstyle. It will match the active ;;dimstyle without the document overrides. (setq newdstyle(vla-add dimstyles "newstyle"))

;;Assuming:
;;<dimobject> is a dimension object

;;Options
;;1) To change a dimstyle to match a document's activedimstyle plus ;;all the document dimension overrides:
(vla-copyfrom newdstyle doc)
;;2) To change a dimstyle to match a dimension object's overrides (vla-copyfrom newdstyle <dimobject>)

To access a dimstyles settings using ActiveX, you may either
1) add a dummy dimension object using that style and then access that dimension's settings or
2) make a dimstyle current and then use (vla-getvariable doc....)

Other than during a reactor callback, you may also entget/entmod the dimstyle properties of the current document via (tblsearch "dimstyle" "yourdimstyle") The dxf code explanations are discussed in "dimstyle group codes."

Does that help or am I missing a point?

Regards,
Doug
 
no, not exactly, (although the difference is insignificant) look at my example again, the dimstyle you're setting does not have to be current(active). you just need a pointer to the dimstyle object, then you set the system variables in the doc, then you use the copyfrom method on your dimstyle object (regardless of whether it is the "active dimstyle" or not) and give it either the document or as Doug shows, another dimstyle object, as the source of the properties to copy.

Doug gives a much better example than mine (naturally). sorry if mine wasn't that clear.
 
Thanks for the clarification, both of you Doug and Mark.

I imagine when I first started 14 years ago, and there was only my shadow to talk too.

Thank again.
 

Latest threads

Back
Top