Jump to content

How to read a shape file


Recommended Posts

I just created a .shp file from a leroy.shx font file. All I wish to do is modify the dash symbol to make it shorter. I have no clue how to read the code that opens in Notepad when veiwing the .shp file

 

Thank you.

Link to comment
Share on other sites

It would be handy if you could either post the file, or add a few lines to a post because it can be tricky.

 

Here are a few lines from a .shp file

 

*0002C,25,kcma

2,8,(10,5),1,9,(-5,0),(0,5),(5,0),(0,-12),(-1,-7),(-2,-5),(0,0),

2,8,(33,15),0

 

*0002D,13,ksub

2,8,(5,33),1,8,(30,0),2,8,(30,-33),0

 

*0002E,21,kper

2,8,(10,5),1,9,(-5,0),(0,5),(5,0),(0,-5),(0,0),2,8,(30,-5),0

 

On each first line of a pair, the figure after the asterisk is the shape number (usually the Unicode code, or could be ASCII code). The next figure is the number of data bytes for the shape, and the last part is the shape name, but in abbreviations so you have to try and work out what it means. On the first line of my example, I think that it is a comma. See what you think.

 

Then the second line is a series of pen movements to draw the shape in X and Y displacements. All fairly logical once you get the hang of it.

 

Whatever you do, keep a copy of the original file in case you want to re-instate it.

Link to comment
Share on other sites

Thanks elson. I am trying to identify and shorten the length of the dash symbol.

;;

;; AutoCAD SHP file generated by dumpshx.exe

;;

*0,4,XUSCOE 5/87 rctoy

21,7,0,0

*00001,2,unspecified

5,0

*0000A,5,lf

2,8,(0,-37),0

*0000D,2,unspecified

6,0

*00020,5,spc

2,8,(12,0),0

*00021,30,kexc

2,8,(5,21),1,8,(0,-14),2,8,(0,-5),1,8,(-1,-1),8,(1,-1),8,(1,1),

8,(-1,1),2,8,(5,-2),0

*00022,21,kdblqt

2,8,(4,21),1,8,(0,-7),2,8,(8,7),1,8,(0,-7),2,8,(4,-14),0

*00023,37,kns

2,8,(11,25),1,8,(-7,-32),2,8,(13,32),1,8,(-7,-32),2,8,(-6,19),1,

8,(14,0),2,8,(-15,-6),1,8,(14,0),2,8,(4,-6),0

*00024,83,kds

2,8,(8,25),1,8,(0,-29),2,8,(4,29),1,8,(0,-29),2,8,(5,22),1,

8,(-2,2),8,(-3,1),8,(-4,0),8,(-3,-1),8,(-2,-2),8,(0,-2),8,(1,-2),

8,(1,-1),8,(2,-1),8,(6,-2),8,(2,-1),8,(1,-1),8,(1,-2),8,(0,-3),

8,(-2,-2),8,(-3,-1),8,(-4,0),8,(-3,1),8,(-2,2),2,8,(17,-3),0

*00025,80,kpc

2,8,(14,13),1,8,(-12,-13),2,8,(3,13),1,8,(1,-1),8,(0,-2),

8,(-1,-1),8,(-2,0),8,(-1,1),8,(0,2),8,(1,1),8,(2,0),8,(4,-1),

8,(3,0),8,(2,1),2,8,(-3,-9),1,8,(-1,-1),8,(0,-2),8,(1,-1),

8,(2,0),8,(1,1),8,(0,2),8,(-1,1),8,(-2,0),2,8,(5,-4),0

*00026,109,kand

2,8,(23,12),1,8,(0,1),8,(-1,1),8,(-1,0),8,(-1,-1),8,(-1,-2),

8,(-2,-5),8,(-2,-3),8,(-2,-2),8,(-2,-1),8,(-4,0),8,(-2,1),

8,(-1,1),8,(-1,2),8,(0,2),8,(1,2),8,(1,1),8,(7,4),8,(1,1),

8,(1,2),8,(0,2),8,(-1,2),8,(-2,1),8,(-2,-1),8,(-1,-2),8,(0,-2),

8,(1,-3),8,(2,-3),8,(5,-7),8,(2,-2),8,(2,-1),8,(2,0),8,(1,1),

8,(0,1),2,8,(3,-2),0

*00027,13,kapos

2,8,(4,21),1,8,(0,-7),2,8,(4,-14),0

*00028,37,klp

2,8,(11,25),1,8,(-2,-2),8,(-2,-3),8,(-2,-4),8,(-1,-5),8,(0,-4),

8,(1,-5),8,(2,-4),8,(2,-3),8,(2,-2),2,8,(3,7),0

*00029,37,krp

2,8,(3,25),1,8,(2,-2),8,(2,-3),8,(2,-4),8,(1,-5),8,(0,-4),

8,(-1,-5),8,(-2,-4),8,(-2,-3),8,(-2,-2),2,8,(11,7),0

*0002A,29,kas

2,8,(8,15),1,8,(0,-12),2,8,(-5,9),1,8,(10,-6),2,8,(0,6),1,

8,(-10,-6),2,8,(13,-6),0

*0002B,21,kpls

2,8,(13,18),1,8,(0,-18),2,8,(-9,9),1,8,(18,0),2,8,(4,-9),0

*0002C,31,kcma

2,8,(6,1),1,8,(-1,-1),8,(-1,1),8,(1,1),8,(1,-1),8,(0,-2),

8,(-1,-2),8,(-1,-1),2,8,(6,4),0

*0002D,13,ksub

2,8,(4,9),1,8,(18,0),2,8,(4,-9),0

*0002E,22,kper

2,8,(5,2),1,8,(-1,-1),8,(1,-1),8,(1,1),8,(-1,1),2,8,(5,-2),0

*0002F,13,kdiv

2,8,(20,25),1,8,(-18,-32),2,8,(20,7),0

*00030,58,n0

2,8,(9,21),1,8,(-3,-1),8,(-2,-3),8,(-1,-5),8,(0,-3),8,(1,-5),

8,(2,-3),8,(3,-1),8,(2,0),8,(3,1),8,(2,3),8,(1,5),8,(0,3),

8,(-1,5),8,(-2,3),8,(-3,1),8,(-2,0),2,8,(11,-21),0

*00031,13,n1

2,8,(6,21),1,8,(0,-21),2,8,(6,0),0

Link to comment
Share on other sites

*0002D,13,ksub

2,8,(4,9),1,8,(18,0),2,8,(4,-9),0

 

I reckon that the dash is this one - ksub could mean subtract, and also the Unicode is the dash or subtract sign.

 

2,8,(4,9) means pen up for x=4 and y=9

1,8,(18,0) means pen down for x=18 and y=0

2,8,(4,-9),0 means pen up for x=4 and y=-9

 

So I would try making the x amount ½ of the pen down, but to preserve the total x movement, I would add 5 to the first x and add 4 to the third x, whilst making the second x=9.

 

So the code would become

*0002D,13,ksub

2,8,(9,9),1,8,(9,0),2,8,(8,-9),0

 

Hopefully that should do what you are wanting :D

Link to comment
Share on other sites

Eldon, you hit the nail on the head! I actually played with a few scenarios and settled on (6,9) (2,0) (6,-9). My new boss wants dimensions with a dot instead of a dash between feet and inches. Thank you very much for steering me in the right direction.

Link to comment
Share on other sites

There is a downside to altering a text file. You are now the only one in the Universe to have that file. If you keep your drawings in-house, or only issue paper drawings, there is no problem. But if you release the digital drawing, and want others to see your nifty handiwork, then you will have to send the altered text shx file. Perhaps you should name the altered text file as leroya.shx or something like that, so the recipient of your file would know that a special text file should be used. :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...