I made a function that subtracts automatically windows from a wall. I copy a polyline drawn onto the wall and extrude it by a meter, then subtract it. It works fine, but, when I get an error that the polyline isn't planar (although it is), it's automatically extruded to a random number greater than 40.000. I'm trying to detect this a d to reduce the extrusion back to 1, but it doesn't seem to work. I can't entmod an entity that has (0 . ACSH_EXTRUSION_CLASS). I see that it's a class, not an entiy, but it's this entity that gives me the extrusion vector.
Here's the code:
(defun c:punch
( / *error*) (command-s "_.undo" "e")
)
(command-s "_.undo" "be")
(princ "\nWindows to punch:") ct 0)
(command-s "_.ucs" "e" wind)
(command-s "_.copy" wind "" "0,0,0" "0,0,0.05" "")
(command-s "_.extrude" hole "" "-1.05")
(command "copy" hole
"" "0,0,0" "0,0,0" "") (princ "\n=====================================holent:\n")(princ holent
) (princ "\n=====================================step1:\n")(princ step1
) (princ "\n=====================================step2:\n")(princ step2
) (princ "\n=====================================step3:\n")(princ step3
) (princ "\n=====================================step4:\n")(princ step4
) )
)
(command-s "_.subtract" wall "" hole "")
)
(command-s "_.undo" "e")
)
The funciton that gets hte extrusion vector looks originally like this:
What I could do is changing back the extrusion or preventing this faulty extrusion from happening.
The polylines that I extrude are fine, most of the times just rectangles, but I still get the error now and then.
Thank you!