'Nother little routine

All of my routines are geometrical in nature and are basically regular ACAD commands with a purpose. Here's a cone-developing thing that was done last
week. Don't know why I never did this before.
A little info: the routine lets you pick 2 lines which would be the generators of a cone. Please make sure that both lines are the same length or you may get funky results. Oh yeah, it's in french, too.
Copy and share.
Dr Fléau
(defun c:conedevelop (/ tmp lin1 lin2 p1 p2 p3 p4 p5 ray ang center oldvar) (setq lin1 (entsel "Première ligne : ") lin2 (entsel "Deuxième ligne :") ) (setq oldvar (getvar "OSMODE")) (setvar "OSMODE" 0) ;;; Extirpe les 4 points des extrémités (setq p1 (cdr (assoc 10 (cdr (entget (car lin1))))) p2 (cdr (assoc 11 (cdr (entget (car lin1))))) p3 (cdr (assoc 10 (cdr (entget (car lin2))))) p4 (cdr (assoc 11 (cdr (entget (car lin2))))) ) ;;; Trouve l'intersection (setq p5 (inters p1 p2 p3 p4 nil)) (if (< (distance p5 p1) (distance p5 p2)) (setq tmp p1 p1 p2 p2 tmp ) ) (if (< (distance p5 p3) (distance p5 p4)) (setq tmp p3 p3 p4 p4 tmp ) ) ;;; Calcule la longueur du cone complet (setq dis (distance p1 p5)) ;;; Trouve le rayon de la base du cone (setq ray (/ (distance p1 p3) 2.0)) ;;; Trouve l'angle de la développante (setq ang (/ (* 360.0 ray) dis)) ;;; Donne le point d'insertion (setq center (getpoint "Donne le point d'insertion :")) (setq temp (polar center (/ pi 2) (- dis (distance p1 p2)))) ;;; Trace la ligne de départ du développement (command "_.line" temp (polar temp (/ pi 2) (distance p1 p2)) "") (command "_-array" (entlast) "" "P" center 2 ang "Y") (command "_arc" "ce" center (polar temp (/ pi 2) (distance p1 p2)) "A" ang) (command "_arc" "ce" center (polar center (/ pi 2) (- dis (distance p1 p2))) "A" ang) (setvar "OSMODE" oldvar) )
Add pictures here
✖
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Using R14. Returns this message:
Command: conedevelop Première ligne : Deuxième ligne :Donne le point d'insertion :int of Unknown command "-ARRAY". Press F1 for help. <Entity name: 3D80968> error: Function cancelled (COMMAND "_-array" (ENTLAST) "" "P" CENTER 2 ANG "Y") (C:CONEDEVELOP)
Brian.
wrote:

Add pictures here
✖
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Try switching the hyphen with a period: "_.array"
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
✖
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Bulatovich) wrote:

Indeed so. Thank you both for the routine.
Brian.
Add pictures here
✖
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.