Point Style & Point Size

303 views
Skip to first unread message

SK

unread,
Jul 20, 2020, 10:15:40 PM7/20/20
to python-ezdxf
How do I set the "Point Size" & "Point Style" when creating a DXF.   I'm trying to achieve importing points from a text file so that they show up as crosshairs instead of dots, then set the crosshairs to an "Absolute size".  Would have thought it'd be similar to setting unit type.

Any help would be much appreciated.

Manfred Moitzi

unread,
Jul 20, 2020, 11:12:49 PM7/20/20
to python-ezdxf
I still don't know that yet, because these properties are not stored in the regular DXF attributes.

SK

unread,
Jul 21, 2020, 12:32:16 AM7/21/20
to python-ezdxf
Most cad programs have this in their document properties, however knowing it's not available means I can stop searching for it. 
As a workaround I'll draw crosshairs with lines so the intersection lies at the point location.

Thanks.

SK

unread,
Jul 21, 2020, 12:49:16 AM7/21/20
to python-ezdxf
I just did a quick save on an R12 ASCII DXF changing only the point size & type and found:

$PDMODE
Changed when the point type was altered

$PDSIZE
Changed when the point size was altered

Is there a function to alter these?

Manfred Moitzi

unread,
Jul 21, 2020, 5:08:33 AM7/21/20
to SK, python-ezdxf
OK, now I understand, ALL points have the same style, stored in $PDMODE and $PDSIZE.


--
You received this message because you are subscribed to a topic in the Google Groups "python-ezdxf" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-ezdxf/E25ZnWSKRaE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-ezdxf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-ezdxf/cc1233b6-b9ff-40ba-b073-aba754e4ee75o%40googlegroups.com.

SK

unread,
Jul 21, 2020, 7:35:36 AM7/21/20
to python-ezdxf
Yes, I'd imagine it would be set similar to set_raster_variables for setting the "units"

SK

unread,
Jul 26, 2020, 7:56:41 AM7/26/20
to python-ezdxf
Thankyou!  saw the updated comments in the point.py function which got me on the right track.  I'm new to Python and finding it great!

Code below works well.  imports points from CSV file into a new DXF with the point style & size set & point ID on separate layer.

CSV Format: PT_ID, X, Y, Z (comes out like that from my survey equipment)
Point ID is offset from the point a little so it dosen't overlap it.

import ezdxf
import csv

doc
= ezdxf.new('R2010')
msp
= doc.modelspace()

# Setup DXF - units already in Metres
doc
.layers.new(name='Point', dxfattribs={'color': 5})
doc
.layers.new(name='ID', dxfattribs={'color': 2})
doc
.header['$PDMODE'] = 2
doc
.header['$PDSIZE'] = 0.05

# Import CSV, Write points to DXF
with open('input.csv', newline='') as csvfile:
    lineread
= csv.reader(csvfile, delimiter=",")
   
for row in lineread:
        msp
.add_text(row[0], dxfattribs={'height': 0.02, 'layer': 'ID'}).set_pos((float(row[1])+0.02,float(row[2])+0.02,float(row[3])), align='LEFT')
        msp
.add_point((float(row[1]), float(row[2]), float(row[3])), dxfattribs={'layer': 'Point'})

doc
.saveas('output.dxf')

Cheers.
Reply all
Reply to author
Forward
0 new messages