Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/22/2020 in all areas

  1. Making a Pattern file A pattern file is a text file, which has a few simple rules. If it is to be a standalone file, then the first line of the file must be *(File-name)(,pattern description if needed). The file name cannot have any spaces, but for clarity it can have underscores. The second and subsequent lines are the description of the lines that form the hatch pattern, and follow the data format shown in the diagram. The angle, coords and dimensions can be taken from the working drawing. The length of a data line is limited to 80 characters. There must be a blank line, without any data, at the end of the file. A stand alone file has to be stored in a folder which is pathed for AutoCAD, so it is available in the Custom patterns. It can also be put in the main pattern file ACAD.PAT or ACADISO.PAT but that is trickier when you are trying to write the pattern. My procedure was to start a text editor with the pattern file loaded, and also start AutoCAD, then one can hatch, write a line into the pattern file and save it, and then (having erased the first hatch) hatch again. AutoCAD always takes the most recent pattern file so one sees whether the last line is doing what it should. I thought a few pictures would explain everything, but if I should have taken shortcuts, please seek further clarification. I have also added my whole hatch pattern file. *Quilt,satin quilt pattern 0,-2.25,0,0,15.36396103,4.5,-3.18198052 0,1.59099026,1.59099026,0,15.36396103,4.5,-3.18198052 0,1.59099026,-1.59099026,0,15.36396103,4.5,-3.18198052 0,5.43198052,3.18198052,0,15.36396103,4.5,-10.86396104 0,5.43198052,-3.18198052,0,15.36396103,4.5,-10.86396104 0,1.59099026,3.84099026,0,15.36396103,2.25,-7.68198052,2.25,-3.18198052 0,1.59099026,-3.84099026,0,15.36396103,2.25,-7.68198052,2.25,-3.18198052 0,3.18198052,5.43198052,0,15.36396103,2.25,-4.5,2.25,-6.36396103 0,3.18198052,-5.43198052,0,15.36396103,2.25,-4.5,2.25,-6.36396103 0,0,-7.68198052,0,15.36396103 45,-1.59099,-1.59099,-10.86396,10.86396,4.5,-3.18198,2.25,-6.36396,2.25,-3.18198 45,0,2.25,-10.86396,10.86396,4.5,-9.54594,4.5,-3.18198 45,2.25,0,-10.86396,10.86396,4.5,-9.54594,4.5,-3.18198 45,6.09099,1.59099,-10.86396,10.86396,10.86396,-10.86396 45,1.59099,6.09099,-10.86396,10.86396,10.86396,-10.86396 45,3.84099,-1.59099,-10.86396,10.86396,2.25,-14.04594,2.25,-3.18198 45,-1.59099,3.84099,-10.86396,10.86396,2.25,-14.04594,2.25,-3.18198 45,-1.59099,-9.27298,-10.86396,10.86396,4.5,-6.36396,4.5,-6.36396 90,0,-2.25,0,15.36396103,4.5,-3.18198052 90,-1.59099026,1.59099026,0,15.36396103,4.5,-3.18198052 90,1.59099026,1.59099026,0,15.36396103,4.5,-3.18198052 90,-3.18198052,5.43198052,0,15.36396103,4.5,-10.86396104 90,3.18198052,5.43098052,0,15.36396103,4.5,-10.86396104 90,-3.82099026,1.59099026,0,15.36396103,2.25,-7.68198052,2.25,-3.18198052 90,3.84099026,1.59099026,0,15.36396103,2.25,-7.68198052,2.25,-3.18198052 90,-5.43098052,3.18198052,0,15.36396103,2.25,-4.5,2.25,-6.36396103 90,5.43198052,3.18198052,0,15.36396103,2.25,-4.5,2.25,-6.36396103 90,7.68098052,0,0,15.36396103 135,1.59099,-1.59099,-10.86396,10.86396,4.5,-3.18198,2.25,-6.36396,2.25,-3.18198 135,-2.25,0,-10.86396,10.86396,4.5,-9.54594,4.5,-3.18198 135,0,2.25,-10.86396,10.86396,4.5,-9.54594,4.5,-3.18198 135,-1.59099,6.09099,-10.86396,10.86396,10.86396,-10.86396 135,-6.09099,1.59099,-10.86396,10.86396,10.86396,-10.86396 135,1.59099,3.84099,-10.86396,10.86396,2.25,-14.04594,2.25,-3.18198 135,-3.84099,-1.59099,-10.86396,10.86396,2.25,-14.04594,2.25,-3.18198 135,9.27298,-1.59099,-10.86396,10.86396,4.5,-6.36396,4.5,-6.36396
    1 point
  2. Yes,. very good, that is the general idea, include a condtional function (Setq text (if p (substr val (+ 2 p)))) That will result to nil, then when the time to use the text variable (if text ... do something) or (Setq text (if p (substr val (+ 2 p)) "")) '<-- leave text variable as blank (Setq text (if p (substr val (+ 2 p)) "Not included)) '<-- or use a defualt value That way, when you include the text variable in a statement. it will still have a value and theres no need for a test (princ (strcat "\nPart number: " number "\nDescription: " text)) and so... (defun c:demo (/ val p number text) (setq val (getstring T "\nEnter Value :")) (setq p (vl-string-position 32 val)) (setq number (substr val 1 p)) (Setq text (if p (substr val (+ 2 p)) "Not Included")) (princ (strcat "\nPart number: " number "\nDescription: " text)) (princ) ) Command: DEMO Enter Value :123 dx Part number: 123 Description: dx Command: DEMO Enter Value :123 Part number: 123 Description: Not Included Command: DEMO Enter Value :1234 df Part number: 1234 Description: df Command: DEMO Enter Value :1234 Part number: 1234 Description: Not Included HTH
    1 point
×
×
  • Create New...