Anyone have a routine that can take pairs of cordinates from a CMM and
generate an outline of a blanked part?
I've got 10 pages of X,Y,Z cordinates and I am hoping to make
a profile.
Printable View
Anyone have a routine that can take pairs of cordinates from a CMM and
generate an outline of a blanked part?
I've got 10 pages of X,Y,Z cordinates and I am hoping to make
a profile.
Robert,
If the CMM can output to a text file I can help you write something to read it in AutoLISP, and draw polylines or lines in AutoCAD. Please paste in a few lines of the file so I can get an idea of what format it is in.
Terry Cadd
I have this as a notepad file and an excel file.Code:DIM LOC7= LOCATION OF POINT PT1
AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
X 1.019 2.000 2.000 -0.317 -1.336 0.000 -#-------
Y 1.745 2.000 2.000 2.525 0.780 0.000 ------#--
Z 1.057 2.000 2.000 1.057 0.000 0.000 ----#----
T 0.000 2.000 2.000 1.547 1.547 0.000 -------#-
I am guessing that I would have to reformat the data in
order to use it in a routine. I have 10 pages of points.
Reordering the data for a routine would still be easier than plotting
each point.
Here is the file. I removed quite a few of the points so that I could
meet the attachment limitation.
Robert,
Run the attached CMM program in a new drawing from the Model tab, and change to the layer you want to use. I've also attached my WordList program which is perfect for processing these types of text files.
Terry Cadd
Code:;-------------------------------------------------------------------------------
; c:CMM - Draws a polyline connecting the points of a CMM file
;-------------------------------------------------------------------------------
(defun c:CMM (/ Filename% First Line1@ Line2@ Line3@ Text$)
(if (not *CMMFilename$)(setq *CMMFilename$ ""))
(setq *CMMFilename$ (getfiled "Select CMM file to Process" *CMMFilename$ "txt" 2))
(if (not *CMMFilename$)(exit))
(setq Filename% (open *CMMFilename$ "r"))
(setq First t Line2@ (list "") Line3@ (list ""))
(while (setq Text$ (read-line FileName%))
(setq Line1@ Line2@ Line2@ Line3@)
(setq Line3@ (Wordlist Text$))
(if (and (= (nth 0 Line1@) "X")(= (nth 0 Line2@) "Y")(= (nth 0 Line3@) "Z"))
(if First
(progn
(setq First nil)
(command "PLINE" (list (atof (nth 1 Line1@))(atof (nth 1 Line2@))(atof (nth 1 Line3@))))
);progn
(command (list (atof (nth 1 Line1@))(atof (nth 1 Line2@))(atof (nth 1 Line3@))))
);if
);if
);while
(close Filename%)
(command "")
(command "ZOOM" "E")
(princ)
);defun c:CMM
;-------------------------------------------------------------------------------
; WordList - Returns a list of words in a sentence
; Arguments: 1
; Sentence$ = String to convert into a list strings
; Syntax: (WordList "Words in a sentence") = (list "Words" "in" "a" "sentence")
; Returns: List of words or strings that were seperated by spaces in a sentence
;-------------------------------------------------------------------------------
(defun WordList (Sentence$ / Cnt# Item$ Mid$ Num# ReturnList@)
(setq Cnt# 1 Num# 1)
(repeat (strlen Sentence$)
(setq Mid$ (substr Sentence$ Cnt# 1))
(if (= Mid$ " ")
(progn
(setq Item$ (substr Sentence$ Num# (- Cnt# Num#)))
(if (/= Item$ "")
(setq ReturnList@ (append ReturnList@ (list Item$)))
);if
(setq Num# (1+ Cnt#))
);progn
);if
(setq Cnt# (1+ Cnt#))
);repeat
(if (not ReturnList@)
(setq ReturnList@ (list Sentence$))
(if (/= (substr Sentence$ Num#) "")
(setq ReturnList@ (append ReturnList@ (list (substr Sentence$ Num#))))
);if
);if
ReturnList@
);defun WordList
;-------------------------------------------------------------------------------