Implementing Python to AutoCAD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good day people of AutoCAD,
firstly, in the link here, I have drew a section view of a model using point cloud, section lines and paperspace.
I am now trying to automate the process that I conducted.
Here is the progress so far.
As you can see in Script 2, I am simply repeating the procedure.
I have heard about pyAutoCAD, which connects python and autocad. Here is the link if anyone is interested.
https://media.readthedocs.org/pdf/pyautocad/latest/pyautocad.pdf
Unfortunately, with current documentation, I am not cleared about its functionality, since what I need are direct implementation of commands in Autocad to Python workspace, Selection of an object purely based on command line/code without using mouse and/or Assignment of variable based on data in AutoCAD.
What I mean by this is that in my python script I wish to import commands directly (eg: PCExtractsection, 3dmove, etc) and select a point cloud without any filter. For now, as you could see, I can use fence and manually type in input, however it is not the most effective way. Also, if I can identify boundary of a point cloud and assign it as variables, all the work can be extremely efficient.
If you know a method for any of above or who to contact to, any help would be greatly appreciated.
***Script 1*** -DWGUNITS 6 2 4 Y Y _POINTCLOUDATTACH "C:\Users\Charlie Lee\Desktop\2d_elevation\point clouds\Kuring_gai_fullpoint.rcp" 0,0,0 1 0 _ai_selall _ai_selall rotate3d X 0,0,0 -90 SECTIONPLANE O T SELECT l _ZOOM e _Cancel ***Script 2*** PCEXTRACTSECTION all a 3DMOVE FENCE 0,170,0 0,180,0 0,0,0 0,0,-0.1 -PCEXTRACTSECTION all 3DMOVE FENCE 0,170,0 0,180,0 0,0,0 0,0,-0.1 -PCEXTRACTSECTION all 3DMOVE FENCE 0,170,0 0,180,0 0,0,0 0,0,-0.1 -PCEXTRACTSECTION all 3DMOVE FENCE 0,170,0 0,180,0 0,0,0 0,0,-0.1 -PCEXTRACTSECTION all 3DMOVE FENCE 0,170,0 0,180,0 0,0,0 0,0,-0.1 -PCEXTRACTSECTION all 3DMOVE FENCE 0,170,0 0,180,0