- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Could anyone help ammend this lips file please. Its part of a longer file.
The lisp ( i think - i'm no programmer ) looks and returns the length of pipe by its name.
It was working fine...however we have now changed the block/file name FROM Pipe Cut To 1170mm - horizontal
TO Pipe-H-1170.
Thanks
Lee
code below
;;;--- Function to get the length from the block name
;;; Example Blockname = "pipe cut to 1170mm - horizontal"
;;; Returns 1170.0 as real number
(defun getLength(blkName)
(setq cnt 1 foundIt 0)
(while(< cnt (- (strlen blkName) 1))
(setq ch(substr blkName cnt 2))
(if(= ch "mm")
(setq foundIt cnt)
)
(setq cnt(+ cnt 1))
)
(if(> foundIt 0)
(progn
(setq nxtLen(substr blkName (- foundIt 2) 2))
(setq len(substr blkName (- foundIt 1) 1))
(setq incCnt 3)
(while(> (atof nxtLen) (atof len))
(setq len nxtLen)
(setq nxtlen(substr blkName (- foundit incCnt) incCnt))
(setq incCnt(+ incCnt 1))
)
)
)
(atof len)
)
Solved! Go to Solution.