Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LISP FOR ELLIPSOIDAL HEAD

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
jac10
3547 Views, 12 Replies

LISP FOR ELLIPSOIDAL HEAD

Please Help!

 

Good Day to Everyone. Is there any person who can make a LISP of the attach file? Im having trouble studying the codes using LISP. Thanks in advance.

 

See attach file for my drawing.

 

Jac10

12 REPLIES 12
Message 2 of 13
stevor
in reply to: jac10

That is not an ellipsoid, it is a 2D  Biarc, and probably determinable,

if the 'givens' are adquate. Pt A or pt 3 must be known.

The hypot, S,  of the 'x' point is R2 - R1 in length,

the base, B,  is (distance p3 p2), and the desending y to pt X is

(sqrt (- (* S S) (* B B))

If Pt 3 is not known, a crown height must be set, like its 'approx' value,

and a similar triangle solution is used.

 

And if the Plan isr circular, a 3D can be created  by rotation.

S
Message 3 of 13
devitg
in reply to: jac10

Do it is your´s case¿

 

 

http://dishedheads.com.au/documents/1601-Head-Types

 

 

If so please contact me , see file attached

Message 4 of 13
jac10
in reply to: jac10

                     Good Day Sir!

                     

                     The ellipsoidal head is actually nearly a 2:1. But in our case it is R=.9045*D. And r=.1727*D.

 

                     The creation of it in LISP can be either input value as D then centerpoint (pt2).

                     Or by click either pt1 then pt2 or vice versa.

                     Is it also possible if pt1 then pt4?

 

                      For example:

                      Given:   D = 1000 mm

                                   R = 0.9045*D =0.9045*1000 = 904.5 mm

                                   r = 0.1727*D =0.1727*1000 = 172.7 mm

 

                      In addition, i added a sequence of creation head. See attach file.

                      I have two option two create an ellipsoidal head. OPTION 1 is much faster than OPTION 2.

                      Hope this two option could make some help.

                           

                     See attach file for the sequence i had made in creation of 2:1 ellipsoidal head.

                      I'm doing this job again and again. I had tried to make a dynamic block.

                     But it is not much used. Value of D always vary.

                     Thanks in advance.

Message 5 of 13
devitg
in reply to: jac10

Hi JAC10 just draw the diametral line ,horizontal .

 

Load the FAS

 

type ELLIP-HEAD at the command line

 

Please check for error.

 

Tell me if you need any more on it 

Message 6 of 13
jac10
in reply to: devitg

Devitg,

 

          Good Day Sir! tHanks a lot for the program. I really appreciate what had you done. This program is very useful in our creation of data sheets.Is there a way that i could modify the .fas in the future? I want to know some of the codes in lsp format. Is it possible for me to have the codes sir? I'm still new to the LISP. Smiley Very Happy

 

Message 7 of 13
stevor
in reply to: jac10

So how do you wish to employ the lisp routine, dwg editor wise?

 

Like I said, the Y desender, from P2 is an easy computation:

 (defun Tri_RRDY (R1 R2 D / w y v )
  (setq w (/ (- D R1 R1) 2.0)  ; P2 to P3
        s (- R2 R1) ; radii dif, side of Tri
        y (if (> s w ) (sqrt (- (* s s) (* w w ))) ))) ; def

 

And the crown height would be R2 - Y.

From that you can manually create the ARCs, or,

make a lisp to do so upon the entry of some points,

like P1, and a X and crown direction,

defaulting to x and y of course.

 

So state show you would do the layout,

point by point, and then

someone will show some code.

 

S
Message 8 of 13
jac10
in reply to: stevor

Good Day Sir!

 

        This is what i expect the lisp would be.

 

         Case 1

         1. By clicking a point from center point of Vessel (pt2) to pt1, 

             OR

            pt1 to pt4 or vice versa.

             whichever is simple.

             Then crown direction either up, down, left and right.

             If i select a point in horizontal line direction he would have i would have a crown direction either up and down

             while making a point along a vertical line direction i would have have a crown direction either left and right.

 

        Case 2

         2. By clicking a diametral line ( like the first solution.) I would like to know his codes in LISP.

             He first select the line then crown direction either up and down.

            

            I have tried to make a vertical line using the case 2 but the results are different. In horizontal line it works very well.

 

           Hope you could help me. Thanks in Advance.Smiley Very Happy

 

 

    

 

Message 9 of 13
jac10
in reply to: devitg

devitg,

  

     I have found some problem. If i tried to make a vertical diametral line. It's result would not be the same as for horizontal line. Hope you can send me the LSP codes. I'm still having some difficulties in making an LSP. I'm still a novice to the program.

Before i make it on the tool pallete. I found it not useful if some drawing varies a lot. I had tried to create a dynamic block also in tool pallete. I think i have to upgrade in some point my skills. Here it now. I'm trying to study some codes.

 

 

 

Message 10 of 13
CADaSchtroumpf
in reply to: jac10

Hi,

 

With your values, you can try this:

(defun c:ELLIPSOIDAL ( / o ptx l lg cc1 cc2 cc3 pt1 pt2 pt3 pt4)
	(setq o (getvar "osmode"))
	(initget 1)
	(while (not (setq ptx (getpoint "\nSpecify the central point of the oval: "))))
	(initget 1)
	(setq l (getdist ptx "\nHalf-length of the big median: "))
	(setq
		lg (* l 2.0)
		cc1 (polar (list (car ptx) (cadr ptx) (caddr ptx)) 0.0 (- l (* lg 0.1727)))
		cc2 (polar (list (car ptx) (cadr ptx) (caddr ptx)) (* pi 1.5) (* lg (- 0.9045 0.2499727278409249)))
		cc3 (polar (list (car ptx) (cadr ptx) (caddr ptx)) pi (- l (* lg 0.1727)))
		pt1 (polar ptx 0.0 l)
		pt2 (polar cc1 1.107104277179586 (* lg 0.1727))
		pt3 (polar cc3 2.034488376410207 (* lg 0.1727))
		pt4 (polar ptx pi l)
	)
	(cond
		((and pt1 cc1 pt2 pt3 pt4)
			(setvar "osmode" 0)
			(setvar "cmdecho" 0)
			(command "_.pline" pt1 "_arc" "_ce" cc1 pt2 "_ce" cc2 pt3 "_ce" cc3 pt4 "")
			(setvar "osmode" o)
			(setvar "cmdecho" 1)
			(command "_.rotate" (entlast) "" "_none" ptx)
		)
	)
	(prin1)
)

 

 

 

Message 11 of 13
stevor
in reply to: jac10

This routine about matches your shape.

In plain autolisp, somewhat documented,

without local vars made yet, 3 Subrs;

for lateral orients, numeric inputs.

 

(princ" Tri_RRDY ")
 ; Orthogonal biarc crown Y offset by diameter
 (defun Tri_RRDY (RK RC D / w y v )
  (setq w (/ (- D RK RK) 2.0)  ; P2 to P3
        s (- RC RK) ; radii dif, side of Tri
        y (if (> s w ) (sqrt (- (* s s) (* w w ))) )))
 
 ; Get_R real 4 places
 (DeFun Get_R (d ps / ans )
  (setq d (if (and d (numberp d)) d 0 )
      ps (if (Str_P ps) ps "\n Enter Number:  ")
     ans (getreal (strcat " " ps " < " (rtos d 2 4) " > ")))
  (if ans ans d))
 
 ; STR_P  STRing-Proof
 (defun Str_p (S) (and s (= 'STR (type s)) ))
 
 
(princ" c:Bacc ")
 ; Biarc crown cap, 2D,  SG-16jan12,
 ; diameter on abscissa, numerical sizing
 (defun c:Bacc (  / ) (princ "\n Biarc 2D crown cap ")
  ; subrs get_ at http://auscadd.com/free-lsp-1.html
  ;* (setq p2 (get_p p2 "\n Mid cap cord Pt 1")) ; base ref pt
  (setq p2 (getpoint "\n Mid cap cord Pt 1")) ; base ref pt
  (setq cd (if cd cd 1000 )  ) ;
  (setq cD (Get_R cd "\n Cap Dia "))
  (setq RK (* cd 0.1727)  RC (* cd 0.9045)) ; ini  
  (setq RK (Get_R RK "\n Knuckle Rad "))
  (setq RC (Get_R RC "\n Crown Rad "))  
  ; descending crown radial Y, from mid cord
  (setq dy ( Tri_RRDY RK RC cd))
  (princ "\n dY: ")(prin1 dy)
  (setq hpi (/ pi 2)   DA 0 ; Half Pi, Diameter Angle
        ; (+ hpi ) for angled creates
        RB (/ cd 2.0)  Rk (- Rb RK ) ; cap Bore, Knuckle rad
        p1 (polar p2 pi RB) ; Knu ends
        op1 (polar p2 0 RB) ; opposite
        odp1 (polar op1 (/ pi 4) 1e9) ; direction pt
        p3 (polar p2 pi Rk) ; Knu centers  
        op3 (polar p2 0 Rk) ; oppo
        Pc (polar p2 (* pi 1.5) dy) ; crown rad center
        Rct (polar pc (angle pc p3) RC) ; curve-curve-tan pt
        oRct (polar pc (angle pc op3) RC) ; oppo
        ctp (polar pc (+ DA hpi) RC)  ; crown top, for demo
        chd (- RC dY) ; crown height, for doc
   )
   ; no layer, osnap, ortho...  factors
   (setq ecc*en (entlast)) ; Delete Ref Ent name
   (command "undo" "mark"
            "pline" op1 "a" "d" "90" oRct Rct p1 "")
   ;
   ;(command "pline" op1 "a" "d" "90" oRct Rct p1 "")
   ; demo pts. optional:
   (command "pline" oRct pc  Rct "" ; tan pts radii
            "line" p1 op1 ""        ; diameter
            "line" pc  ctp "" )     ; ordinate
   (princ" done") (princ)
 ) ; end def
 
 

S
Message 12 of 13
jac10
in reply to: CADaSchtroumpf

 

 CADaStroumph

 

                 Good Day Sir..

 

                             Your solution is great. I'm using it in my work.Thanks a lot..Hope I could create my own LSP. I'm already tired of making dynamic blocks. It's already tired of always making new one and adding it to tool palletes.

 

                  

Message 13 of 13
jac10
in reply to: stevor

Stevor, To all

 

           Good Day Sir! Your codes help me a lot. Hope to create my own in the future. God Bless All of You Guys.

 

To DevitG,

 

         I think Mr. CADaStroumph got it right. I already using his program in LSP. Hope you could send your codes to me in LSP. Thanks in advance.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost