Correct or missing?

Rudy Tovar

Usenet Archive
Joined
Jul 8, 2003
Messages
631
Reaction score
0
Set existing dimstyle "ARCH1" current.

; Property values:
; Application (RO) = #<VLA-OBJECT 00b287f0>
; Name = "ARCH2"
; Methods supported:
; Delete
; GetXData (3)
; SetXData (2)

(setq a (vla-get-activedimstyle (vla-get-ActiveDocument (vlax-get-Acad-Object)))) (vla-put-name a "arch1");<errors out..

Or am I barking up the wrong tree. I'm just brain dead.
 
From the ActiveX docs:

Name

String;
Read-write for the following objects: Block, BlockRef, Dictionary, DimStyle, Group, Layer, Layout, Linetype, PlotConfiguration, PopupMenu, Raster, RegisteredApplication, Shape, Toolbar, ToolbarItem, UCS, View, Viewport, XRecord.

Read-only for the following objects: Application, Document, MenuGroup, ModelSpace, PaperSpace, SelectionSet, TextStyle.

--
R. Robert Bell, MCSE
www.AcadX.com

| Set existing dimstyle "ARCH1" current.
|
| ; Property values:
| ; Application (RO) = #<VLA-OBJECT 00b287f0>
| ; Name = "ARCH2"
| ; Methods supported:
| ; Delete
| ; GetXData (3)
| ; SetXData (2)
|
|
| (setq a (vla-get-activedimstyle (vla-get-ActiveDocument | (vlax-get-Acad-Object)))) | (vla-put-name a "arch1");<errors out.. | | Or am I barking up the wrong tree. I'm just brain dead. | |
 
It looks like you are trying to put an object where it's expecting a name. (setq a (vla-get-name (vla-get-activedimstyle (vla-get-ActiveDocument (vlax-get-Acad-Object))))) Would make a the name of the active dimstyle.
Or am I missing something?

Bill
 
I get the following error also for-
*** ERROR: argument type mismatch: "arch1"
(vla-put-activedimstyle (vla-get-ActiveDocument (vlax-get-Acad-Object))
"ARCH1")
 
Rudy,

Do you want to rename ARCH2 -> ARCH1

(setq a (vla-get-activedimstyle
(vla-get-ActiveDocument
(vlax-get-Acad-Object))))

;; rename dimension style
(vla-put-name a "ARCH1")

;; update the dimension style list
(vla-update (vlax-get-acad-object))

Then it won't be necessary to make it current.

hth.
 
if you are trying to set the current dimstyle to "arch1":

(setq a (vla-get-activedimstyle (vla-get-ActiveDocument

(vlax-get-Acad-Object))))
(vla-put-name a "arch1");<--only changes the name of the dimstyle

(setq dimstyl (vla-item (vla-get-dimstyles doc) "arch1"));get the arch1 dimstyle

(vla-put-activedimstyle doc dimstyl);set current style to arch1

HTH,
Jeff
 
I have existing dimstyles and be able to toggle from one to the other just like setvar.

I tried setvariable, but that didn't work.

Supposedly you can set another existing dimstyle current using activex.
 
I tried that too...

I'll try it again...thanks.........................

It worked! Thanks for rattling my brain.
 
So you have to return the existing ENTIRE object, and set it via vla-put-activedimstyle. That's what I was looking at in my face and my brain kept telling me, but I didn't understand because I was so use to setting only face values, as strings and arrays.

Thanks for draining my brain....
 
Rudy,

This is what I use to set a dimstyle current:

(defun put-activedimstyle (dimname / dimstyle thisdwg) (if (not (vl-catch-all-error-p (setq dimstyle (vl-catch-all-apply 'vla-item (list (vla-get-dimstyles (setq thisdwg (vla-get-activedocument (vlax-get-acad-object)))) dimname))))) (vla-put-activedimstyle thisdwg dimstyle)))

hth
 
I'll have to review this once more.

It's creating a copy of the existing style and saving it with the same name as the existing name I'd like to make current.

I'll give Luis a try.
 
Rudy,
Luis' and my are essentially the same. If you are using everything I posted, that is NOT what you want to be doing. I was merely showing you what your original code was doing, then showing HOW you should be doing it.....

Jeff
 
That's true ... is the same... as Jeff coding...

Asi es, solo que en mi caso la funcion revisa que exista el nombre del estilo primero antes de hacerlo vigente.

Suerte,
Luis.
 
Sinerio - Existing dimstyles - toggle from one to another, via toolbar.

If not existing dimstyle, make dimstyle, then set dimstyle current.

That's it, but using your method is causing autocad to create another +arch1 and save with that name current settings.

I'll look at it a bit more this afternoon. Perhaps I'm doing something out of order.

Also, I'm making it work in different versions, R14-2004.
 
Rudy,
This may already have been answered.

The reason for the error is that you can't rename the
active dimension style to the name of another dimstyle
in the current drawing. Each dimstyle must have a unique identifier. If you are trying to switch dimstyles, then

(setq doc (vla-get-activedocument(vlax-get-acad-object)) nds (vla-item (vla-get-dimstyles doc) "arch1")) ;<--any valid dimstyle name (vla-put-activedimstyle doc nds)
 

Latest threads

Back
Top