Author Topic: Find all characters in a SHX file?  (Read 4633 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 653
Find all characters in a SHX file?
« on: January 30, 2014, 09:44:24 AM »
Is there a way in (V)Lisp to find all characters which are defined in a SHX file? I need a list like "A, B, C" or better Ascii-codes or Unicode-definitions like "\u+1234".
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Find all characters in a SHX file?
« Reply #1 on: January 30, 2014, 11:43:45 AM »
If you covert the shx file back into a shp file it would be very easy.

SHX2SHP.EXE used to be included in the core ACAD install.  I don't know if it still is

With a little digging you should able to find the shapefile ( .shp ) format.

I take a look see myself as to what is out there.

-David
R12 Dos - A2K

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Find all characters in a SHX file?
« Reply #2 on: January 30, 2014, 11:59:40 AM »
Starting with Page 117

http://docs.autodesk.com/ACDMAC/2013/ENU/PDFs/acdmac_2013_customization_guide.pdf



I have 6 copies of SHX2SHP.EXE on this machine.  They are all the same file, just different locations
Code: [Select]
     Disk Volume:                           1-30-14  11:51:28 am   Page 1
                      Available space    207,271,845,888 bytes
              583,261 logged files using 338,111,105,903 bytes
                    6 tagged files using          90,132 bytes

      Path: C:\ACAD\FONTS
                    1 tagged files using          15,022 bytes

 6-17-95   8:56:18 pm      15,022 .a.. SHX2SHP .EXE

      Path: C:\ACAD\UT
                    1 tagged files using          15,022 bytes

 6-17-95   8:56:18 pm      15,022 .a.. SHX2SHP .EXE

      Path: C:\Documents and Settings\Public\acad\FONTS
                    1 tagged files using          15,022 bytes

 6-17-95   8:56:18 pm      15,022 .a.. SHX2SHP .EXE

      Path: C:\Documents and Settings\Public\acad\UT
                    1 tagged files using          15,022 bytes

 6-17-95   8:56:18 pm      15,022 .a.. SHX2SHP .EXE

      Path: C:\Users\Public\acad\FONTS
                    1 tagged files using          15,022 bytes

 6-17-95   8:56:18 pm      15,022 .a.. SHX2SHP .EXE

      Path: C:\Users\Public\acad\UT
                    1 tagged files using          15,022 bytes

 6-17-95   8:56:18 pm      15,022 .a.. SHX2SHP .EXE

I'll take credit for (2) of these, the rest were installed by ACAD somewhere along the line.

-David
R12 Dos - A2K

Peter2

  • Swamp Rat
  • Posts: 653
Re: Find all characters in a SHX file?
« Reply #3 on: January 30, 2014, 12:14:14 PM »
If you covert the shx file back into a shp file it would be very easy.....
Thanks, but the idea is to create a kind of simple SHX Viewer inside AutoCAD. The software should
a) find all defined characters in a defined SHX
b) create a TEXT in AutoCAD for each character

b) is simple, a) is what I'm asking for.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Find all characters in a SHX file?
« Reply #4 on: January 30, 2014, 01:02:44 PM »
Doing viewer is very simple.  However it will not inform you as to what is defined or not.  AutoCAD will simply display a question mark for unknown characters.

You will have to go back to the original shape file definitions.  -David
R12 Dos - A2K

Peter2

  • Swamp Rat
  • Posts: 653
Re: Find all characters in a SHX file?
« Reply #5 on: January 30, 2014, 02:33:27 PM »
...However it will not inform you as to what is defined or not....
That's the problem. A font which uses some special characters at ANSI Code 8000 or 10000 creates a lot of trash if I print thousands of question marks.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Find all characters in a SHX file?
« Reply #6 on: January 31, 2014, 06:11:06 AM »
You will have to test for BIGFONTS, SHAPE formatted files and whether the shape_number is either HEX or Decimal

This could be the base engine :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:findchr (/ file rf nl c f fd hl)
  2.    (while (not file)
  3.           (setq file
  4.              (getfiled "Shape File to Read"
  5.                        (if shp_file shp_file "/acad/fonts/")  "shp" 2)))
  6.   (setq shp_file file)
  7.   (setq hl nil)
  8.   (setq rf (open file "r"))
  9.   (while (setq nl (read-line rf))
  10.          (cond ((= "*0,4," (substr nl 1 5))
  11.                 (setq fd (substr nl 6)))
  12.                ((= "*"   (substr nl 1 1))
  13.                 (setq c 3 f nil)
  14.                 (while (and (not f)
  15.                             (< c (- (strlen nl) 3)))
  16.                        (if (= "," (substr nl c 1))
  17.                            (setq f T
  18.                                  hl (cons (substr nl 2 (- c 2)) hl)))
  19.                        (setq c (1+ c))))))
  20.   (close rf)
  21.   (princ (strcat "\n" (rtos (length hl) 2 0) " Characters Found In " file ", " fd))
  22.   (prin1))
  23.  

The list hl contains the shape_numbers of the characters defined in the selected .shp file.

-David
« Last Edit: January 31, 2014, 08:12:12 AM by David Bethel »
R12 Dos - A2K

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Find all characters in a SHX file?
« Reply #7 on: February 01, 2014, 10:13:48 AM »
Thanks, but the idea is to create a kind of simple SHX Viewer inside AutoCAD.
You could always use findfile to check if there's already a SHP file with the same name as the SHX. Then if not found use startapp function to run the SHX2SHP on the SHX file to create a SHP. Then use something like David's code to figure out which characters / shapes are defined in that font/shape file.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.