Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dimscale update, vlax-put-property

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
465 Views, 8 Replies

Dimscale update, vlax-put-property

All,

I have the lisp below and it works really well to switch a dimsytle without altering the overrides. Hooray for searching the board!

The problem I am having is using this same routine to set the dimensions scale factor. I thought the DXF code for a dimensions scale factor was 40...if so why does the substitution crap out? Am I confused about the DXF Code?

Loosing ground there, I then try to use vlax-put-property and I'm fighting a loosing battle here to. What am I missing here?

So...I guess there are two questions:

1. Where can I find the DXF code for a dimensions scale factor
2. Even if I get the DXF to work, I assume VLAX is the better route but I can't get it to work...what is the proper syntax here?

Code:

defun c:d32 (/)
(setq dimset (ssget "X" '((0 . "DIMENSION") (3 . "DIM-32"))))
(vl-load-com)
(setq nn 0)
(while (ssname dimset nn)
(setq entdata (entget (ssname dimset nn)))
(entmod (SubstDXF entdata 3 "H2l2-DIMS"))
(setq en (vlax-ename->vla-object (cdr (assoc 1 entdata))))
(vlax-put-property en scalefactor 32)
;;(entmod (SubstDXF entdata 40 "32"));;Why doesn't this work?
(setq nn (+ nn 1))
)
)
;;------------------------------------------------
(defun SubstDXF (entgetlist dxf newvalue /)
(if (assoc dxf entgetlist)
(subst (cons dxf newvalue)
(assoc dxf entgetlist)
entgetlist
)
(append entgetlist (list (cons dxf newvalue)))
)
)

I have attached the file I have been testing with.

Thanks for any help,
Drew
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

In your example.. entdata 3 gets a string (name).. that's OK.
But, entdata 40 needs an integer.. e.g. 32, not "32".
For the VL function..(vlax-put-property en scalefactor 32)
.. try:
(vlax-put-property en 'Scalefactor 32)

Bob
Message 3 of 9
Anonymous
in reply to: Anonymous

Bob,

Thanks...I just looked at the vlax-put-property reference section again and say the 'scalefactor, just like you said....not to mention I was handeling the entiy 'poorly. It works great now...thank you.

Now the question must be asked...what is the proper name (ala 'Scalefactor) for the dimensions dimstyle? More importantly, where can I find a list of such names...the manual is not giving them up easily.

Thanks,
Drew
Message 4 of 9
Anonymous
in reply to: Anonymous

Place a Dim on your drawing.. use this object dump.. function
to get a list of that entity..
;; dump.lsp
(defun C:dump (/ e)
(vl-load-com)
(setq e (entsel))
(setq obj (vlax-ename->vla-object (car e)))
(vlax-dump-object obj T)
(princ)
); end function
(C:dump)

Bob
Message 5 of 9
Anonymous
in reply to: Anonymous

Ha! Now thats handy. Thank you.
Message 6 of 9
Anonymous
in reply to: Anonymous

You are very welcome. !

Bob Shaw
Message 7 of 9
Anonymous
in reply to: Anonymous

Turns out I can change the sytle with vlax too (wicked simple...can't believe I shied way from vla-vlax for so long) though it does not preserve the overrides as the entmod method does. I assume I would have to read out all the vlax properties I want to keep, then read them back in to the changed dimension...is this right?

If so, is there an easy way to read out everything about a dimension object (similar to your dump routine), change a few things in that readout (like 'StyleName and 'ScaleFactor) and then 'reverse dump' it back into the dimension?

I have to say, this has been rather eye opening, thank you.

dRew

Thanks again,
Drew
Message 8 of 9
Anonymous
in reply to: Anonymous

Drew,

I think you want to use the CopyFrom method.

Joe Burke

wrote in message news:5781521@discussion.autodesk.com...
Turns out I can change the sytle with vlax too (wicked simple...can't believe I shied
way from vla-vlax for so long) though it does not preserve the overrides as the
entmod method does. I assume I would have to read out all the vlax properties I want
to keep, then read them back in to the changed dimension...is this right?

If so, is there an easy way to read out everything about a dimension object (similar
to your dump routine), change a few things in that readout (like 'StyleName and
'ScaleFactor) and then 'reverse dump' it back into the dimension?

I have to say, this has been rather eye opening, thank you.

dRew

Thanks again,
Drew
Message 9 of 9
Anonymous
in reply to: Anonymous

Joe,

Thanks for the pointer, I'll play check it out today.

Thanks,
Drew

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost