
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello everyone!
It is possible "get certain string from file name and change dimention scale " ?
To be specific.. if filename contains 1:100(1:200 or1:300...), it is the same as changing the scale of the dimensions
i found like someting below...
- read filename
(defun C:pTxt()
(setq fname(getstring "\n Enter a valid file name: "))
(if(setq f(open fname "r"))
(while (setq txtLine(read-line f))
(princ txtLine)
)
(princ "\n Error - Could not find file")
)
)
- find certain string from list
(defun c:test(/ a yes)
(setq a (list "1" "2" "3"))
(setq yes (searchstring a "2"))
(if(= yes t)
(prompt "found")
(prompt "Not found")
)
)
- Change Dimension sclae
(defun c:Dimsc ( / *error* _StartUndo _EndUndo doc ss deflt old_b_scale alrim bp ojt )
(vl-load-com)
(defun *error* ( msg )
(and doc (_EndUndo doc))
(or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
(princ (strcat "\n** Error: " msg " **")))
(princ)
)
(defun _StartUndo ( doc ) (_EndUndo doc)
(vla-StartUndoMark doc)
)
(defun _EndUndo ( doc )
(if (= 8 (logand 8 (getvar 'UNDOCTL)))
(vla-EndUndoMark doc)
)
)
(setq fname(getstring "\n Enter a valid file name: "))
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(if (ssget "_X" '((0 . "*DIMENSION")))
(progn
(setq *scl* 1)
(setq *oscl*
(cond
(
(getdist
(strcat "\nSpecify Overall Scale Factor(Specify Overall Scale Factor) <"
(rtos
(setq *oscl* (cond ( *oscl* ) ( 1.0 )))
)
"> : "
)
)
)
( *oscl* )
)
)
(_StartUndo doc)
(vlax-for o (setq ss (vla-get-ActiveSelectionSet doc))
(mapcar
(function
(lambda ( prop value )
(if (vlax-property-available-p o prop)
(vlax-put-property o prop value)
)
)
)
'(LinearScaleFactor ScaleFactor) (list *scl* *oscl*)
)
)
(vla-delete ss)
(_EndUndo doc)
)
)
(princ)
)
Therefore, how can i mix these things to create what i want?
Please help me
thank you
Solved! Go to Solution.