Originally Posted by
mbrandt5
Thanks a lot I greatly appreciate it...
I'm not very fluent in vlax for lisp...
So is anyone will to help me apply a sort of ssget so this can apply to multiple dimensions at once.
I'm assuming ahouston972454's code works on individually picked objects. I'm not testing it.
There is one line in there which would needs some tweaking to make it work on multiple objects. Of course, you would need to also add another closed parenthesis near the end as you would want to loop through the selection set.
So, let's tweak some code. The following code removes the ability to select a dimension. Instead, it now requires you to supply an entity name to perform the necessary changes. By doing this we now have a function that does one performs part of the overall routine you are asking someone to provide to you.
Code:
(defun _candim ( ent / obj sc scf)
(vl-load-com)
(setq obj (vlax-ename->vla-object ent))
(setq sc (getvar 'cannoscale))
(cond
((= sc "1/4\" = 1'-0\"")(setq scf 0.25))
((= sc "1/2\" = 1'-0\"")(setq scf 0.5))
)
(vla-put-LinearScaleFactor obj scf)
)
Of course, you are thinking, "I don't want less functionality from the previous code. I want more functionality added to it.
Now that we have the simple minded task created, we can look at reusing that code to perform the task on multiple items.
So, now, let's write some code to select a bunch of objects and execute the simple task on each item.
Code:
(defun c:candim ( / ss cnt )
(setq ss (ssget '((0 . "DIMENSION")))) ; Select dimension entities
(if (> (setq cnt (sslength ss)) 0)
(repeat cnt
(_candim (ssname ss (setq cnt (1- cnt))))
)
)
)
By separating out the tasks, we can then build routines as building blocks to make larger routines. Is this the most efficient code? Probably not. I didn't add anything to improve efficiency. However, the code does answer the additional request.
Good Luck.