- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am a beginner in autolisp and i would like to create a script/routine for creating plane surfaces. I think I've come close, but something is wrong in it, so any help would be greatly appreciated.
I would like the user to select number of entities/objects - certain number of closed polylines. Each of these polylines is in different layer. For every polyline from the selection, i would like to create plane surface (planesurf command). But these surfaces will be in active layer and i would like them in same layer as the polyline is.
The desired steps of the script:
1) prompt user to do a selection of polylines.
2) cycle through these
3) each step of the loop would contain:
Get the name of polyline's layer
Change active layer to the layer of polyline
Select that polyline
perform command "planesurf"
4) repeat the cycle for all polylines of the selection.
My code, which doesn't work properly:
(setq ss1 (ssget))
(repeat (setq i (sslength ss1))
(setq list1 (cons (ssname ss1 (setq i (1- i))) list1))
)
(setq ss1 nil)
(foreach n list1 (progn
(setq layer (cdr (assoc 8 (entget n))))
(setq selset (ssadd n))
(sssetfirst nil selset)
(setvar "CLAYER" layer)
(command "_planesurf" "")
(setq selset nil)
)
)
The script now says "error - function cancelled", prompts user for selection for second time and creates plane surfaces in all polylines but the surfaces are all in one layer.
Attached is my testing file, unfortunately i dont have the final file yet. But it will be the same, just more layers and more polylines. In the attached file for testing, there are only 3 polylines in 3 layers starting with "_"
Thank you in advance
Solved! Go to Solution.