How to create a simple point? #616
-
| 
         POINT HI! I need the simple point information to be in the exported file. How can I do this? I didn't find the solution I needed in the documentation  | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            danmarshall
          
      
      
        Dec 2, 2024 
      
    
    Replies: 1 comment
-
| 
         Maker.js ought to have a better way of handling DXF entities. Until then, you might be able to inject into the entities section. Here is example DXF for a drawing with only a circle: I believe you can add your points before the end of the final section. I haven't tried this, but here's a function written by ChatGPT: function injectPoint(dxfData, pointData) {
  // Find the index of the last line of the ENTITIES section before it ends
  const endEntitiesIndex = dxfData.lastIndexOf('0\nENDSEC\n', dxfData.indexOf('0\nSECTION\n2\nENTITIES'));
  if (endEntitiesIndex === -1) {
    return "Invalid DXF data"; // or handle error more appropriately
  }
  // Insert the point data before the end of the ENTITIES section
  return dxfData.substring(0, endEntitiesIndex) + pointData + dxfData.substring(endEntitiesIndex);
} | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        radar4ick
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Maker.js ought to have a better way of handling DXF entities. Until then, you might be able to inject into the entities section. Here is example DXF for a drawing with only a circle:
I believe you can add your points before the end of the final section. I haven't tried this, but here's a function written by ChatGPT: