-- goal is to use leaders to have pointers with text indicating for instance heights or name materials, etc. use skethup tool Text (leader with text) not attacing it to any object. link to definition: https://documentation.help/AutoCAD-DXF/WS1a9193826455f5ff18cb41610ec0a2e719-7a02.htm Possible values for Code 73 Leader creation flag (default = 3): 0 = Created with text annotation 1 = Created with tolerance annotation 2 = Created with block reference annotation 3 = Created without any annotation Example values are taken from the file "dxf issues with special chars.dxf" Example of a hooked leader line with text: ... 0 --class LEADER -- LEADER class 5 -- handle 45D ... 100 AcDbEntity 8 -- layer 01_Linien ... 100 AcDbLeader 3 -- Dimension style name ERSTELLTER_STIL__8 73 -- Leader creation flag (default = 3 - leader without annotation ): 0 -- create with text annotation. 74 -- Hookline direction flag: (probably we do not need) -- 0 = Hookline (or end of tangent for a splined leader) is the opposite direction from the horizontal vector -- 1 = Hookline (or end of tangent for a splined leader) is the same direction as horizontal vector (see code 75) 0 40 -- height of text annotation box 0.1861200073957443 41 -- width of text annotation box 2.365020093977451 76 -- number of vertices in leader line 2 -- here we have two vertices. a beginning and end point 10 -- there are multiple (x,y,z) points (10,20,30). Only use the first one as this is the starting point 0.2350246010019716 20 23.23973242126534 30 0.0 10 -- x coord of second point. use the last one to calc the vector needed in SketchUp 2.156191826437881 20 -- y coord of second point 23.71269979155023 30 -- z coord of second point 0.0 340 -- hard link to MTEXT or block or INSERT. but we should support only MTEXT link 45E -- search vor code 5 with same value to find MTEXT 211 --“Horizontal” direction for leader 0.9693654083247027 221 0.2456230957045413 231 0.0 ... 0 MTEXT 5 -- handle, links back to code 340 in Leader object 45E ... 100 AcDbEntity 8 -- layer 01_Linien ... 100 AcDbMText ... 1 \A1;{\fArial|b0|i0|c0|p34;OK Mauer ca. 549.79} ... # Transform to SketchUp: # DXF codes indicated in variables staring with p (point) or v(vector) or c(any code): # leader type c73 = 0 # number of verices , take the firs and the last, ignroe the ones in between c76 = 2 # starting point of SketchUp Text p10s = "0.2350246010019716m".to_l p20s = "23.71269979155023m".to_l p30s = "0.0m".to_l # end point of SketchUp Text this the occurrence of the point (10,20,30) indicated in Code 76 p10e = "2.156191826437881m".to_l p20e = "23.71269979155023m".to_l p30e = "0.0m".to_l # annotation text, not needed, if we only draw the leader line c1 = "\A1;{\fArial|b0|i0|c0|p34;OK Mauer ca. 549.79}" 0 LEADER 5 455 ... 100 AcDbEntity 8 -- layer 01_Linien ... 100 AcDbLeader 3 -- style ERSTELLTER_STIL__8 73 -- leader type 0 ... 76 -- number of vertices 2 10 -- start point 0.8933383387278445 20 20.07616254294711 30 0.0 10 -- end point 1.843283190558974 20 20.0556887295855 30 0.0 340 -- hande of related MText 456 ... 0 MTEXT 5 456 ... 100 AcDbEntity 8 01_Linien ... 100 AcDbMText ... 1 \A1;\A1;\A1;{\fArial|b0|i0|c0|p34;547.32} ... # Transform to SketchUp: # DXF codes indicated in variables staring with p (point) or v(vector) or c(any code): # leader type c73 = 0 # number of verices , take the firs and the last, ignroe the ones in between c76 = 2 # starting point of SketchUp Text p10s = "0.8933383387278445m".to_l p20s = "20.07616254294711m".to_l p30s = "0.0m".to_l # end point of SketchUp Text this the occurrence of the point (10,20,30) indicated in Code 76 p10e = "1.843283190558974m".to_l p20e = "20.0556887295855m".to_l p30e = "0.0m".to_l # annotation text, not needed, if we only draw the leader line c1 = "\A1;\A1;\A1;{\fArial|b0|i0|c0|p34;547.32}" 0 LEADER 5 459 ... 100 AcDbEntity 8 -- layer 01_Linien ... 100 AcDbLeader 3 -- stye ERSTELLTER_STIL__8 73 -- leader type 0 ... 76 -- number of vertices 2 10 0.2357477944377185 20 17.524072953701 30 0.0 10 2.214148233044702 20 17.50141582001132 30 0.0 340 45A ... 0 MTEXT 5 45A ... 100 AcDbEntity 8 01_Linien ... 100 AcDbMText ... 1 \A1;\A1;\A1;{\fArial|b0|i0|c0|p34;OK Mauer ca. 548.80} ... # Transform to SketchUp: # DXF codes indicated in variables staring with p (point) or v(vector) or c(any code): # leader type c73 = 0 # number of verices , take the firs and the last, ignroe the ones in between c76 = 2 # starting point of SketchUp Text p10s = "0.2357477944377185m".to_l p20s = "17.524072953701m".to_l p30s = "0.0m".to_l # end point of SketchUp Text this the occurrence of the point (10,20,30) indicated in Code 76 p10e = "2.214148233044702m".to_l p20e = "17.50141582001132m".to_l p30e = "0.0m".to_l # annotation text, not needed, if we only draw the leader line c1 = "\A1;\A1;\A1;{\fArial|b0|i0|c0|p34;OK Mauer ca. 548.80}" 0 LEADER 5 461 330 1F 100 AcDbEntity 8 0_WP_Plankopf_1_50_(AaA) ... 100 AcDbLeader 3 -- style ERSTELLTER_STIL__9 73 -- leader type 0 75 -- Hookline flag: 0 = No hookline; 1 = Has a hookline. This seems to set if MORE than two verices in Code 76. but we do not need 1 ... 76 -- number of vertices in leader, take only first and last 3 10 -- start position 0.9616737862169167 20 16.05730627056626 30 0.0 10 0.8016737862169165 20 16.16410309801638 30 0.0 10 -- end position 0.6876737862169165 20 16.16410309801638 30 0.0 340 -- link to MTEXT handle 462 ... 0 MTEXT 5 462 -- MTEXT handle ... 100 AcDbEntity 8 -- layer 0_WP_Plankopf_1_50_(AaA) ... 100 AcDbMText ... 1 \A1;\A1;\A1;{\fArial|b0|i0|c0|p34;Knickarmmarkise} ... # Transform to SketchUp: # DXF codes indicated in variables staring with p (point) or v(vector) or c(any code): # leader type c73 = 0 # number of verices , take the firs and the last, ignroe the ones in between c76 = 3 # starting point of SketchUp Text p10s = "0.9616737862169167m".to_l p20s = "16.05730627056626m".to_l p30s = "0.0m".to_l # end point of SketchUp Text this the occurrence of the point (10,20,30) indicated in Code 76 p10e = "0.6876737862169165m".to_l p20e = "16.16410309801638m".to_l p30e = "0.0m".to_l # annotation text, not needed, if we only draw the leader line c1 = "\A1;\A1;\A1;{\fArial|b0|i0|c0|p34;Knickarmmarkise}" # create sketchup text with leader based on the above done variable assignment: entities = Sketchup.active_model.entities # start and end point are the first and last (10,20,30) coordinates from dxf Leader p0s = Geom::Point3d.new(p10s, p20s, p30s) p0e = Geom::Point3d.new(p10e, p20e, p30e) v0s = Geom::Vector3d.new(p0s.to_a) v0e = Geom::Vector3d.new(p0e.to_a) # v0 corresponds to the vector between the start and end point. v0 = v0e - v0s #text corresponds to the MText value stored in code 1 t = c1 # create SketchUp text text = entities.add_text t, p0s, v0 # but we could also leave the text empty and just draw the leader, as MText is already imported. # Disadvanage is that the SketchUp Text changes when orbiting, so adding the text would be nicer. # text = entities.add_text "", p0s, v0 #Text font: # change to the one in dxf as already read during the import. # use as well a font size in mm/inch and not pixels, because then the leader zooms in and out like the other 3DText imported # Leader type: # Valid leader types are 0 for none, 1 for View-based, and 2 for Pushpin # is always 2 text.leader_type=2 # Arrow Type: # Valid arrow types are 0 for none, 2 for dot, 3 for closed arrow, 4 for open arrow. # not sure what to do here. I would leave the sketchUp default set by the user text.arrow_type = 2 # Line weight in pixels: Default is 1 # take from style, if easily available, otherwise leave the default text.line_weight = 3