
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am currently working on writing a Autolisp script that will allow me to flatten a specific region of a 3D solid after removing all other regions and surfaces. I have no prior experience with autolisp so my code has been a product of what I can work out from research. The program starts with a copy and move of the 3D solid, so I can overlay the solid on the flattened profile after running all the commands on the solid that is to be flattened. This beginning code looks like this:
(defun C:SE1 () (setq select1 (ssget "W" '(0 0) '(150 100))) (command "copy" select1 "" "0,0,0" "150,0,0") (command "explode" select1 "") (princ) )
I think I will be able to work out the code required to flatten and join the polyline (this will be a seperate fuction as the user needs to remove lines manually before the flatten).
If you look at the file I have attached and explode the solid you can see the number of regions/surfaces it creates. Along the lower edge, there is a surface that runs the full outer perimeter. My goal is to remove everything but just that surface. So far I have tried to find some ssget funtion that will allow me to select everything above that Z-axis, but there doesn't seem to be a easy way to approach it. It seems that using a filter value would make sense:
(setq selectdel (ssget "X" '((-4 . "*,*,<>")(100 0.0 0.0 1.0)))) (command "erase" selectdel "")
The issue is that I don't think -4 is the correct code, but I can't find out what would be the right group code. The second concept I tried was using a rotation of the ucs to make it a operation of the xy-axis instead of the z-axis:
(command "ucs" "x" "-90") (setq selectdel (ssget "w" '(0.1 0.1) '(-100.0 -100.0))) (command "erase" selectdel "")
This doesn't seem to work either, possibly because it doesnt recognize all the things with non-zero z-axis values?
It is very likely my mindset for the code is not correct for lisp, as I am basically trying to get it to replicate the steps that I can preform manually. If you can help point me in the correct direction then it would be much appriciated.
Solved! Go to Solution.