Jump to content

Mobius Strip?


Guest dangermouse

Recommended Posts

  • Replies 47
  • Created
  • Last Reply

Top Posters In This Topic

  • fuccaro

    19

  • Mr T

    7

  • CADTutor

    3

  • a1harps

    2

Top Posters In This Topic

Posted Images

No offense, my Scottish friends. Just some sense of humor ple(eee)ase, if it is possible!

 

Ah it's ok. The funny thing is that on average scots give more to charity than their british counterparts.

 

Nick

Link to comment
Share on other sites

  • 11 months later...

For a solid Mobius strip:

 

mob0.png

;|    Solid Mobius strip
   [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email]
------------------------------October, 2004 ----------|;

(defun c:mobius( / w h r ang0 ang1 ang2 c0 N0 N1 N2 segs lx ly ss)

 (setq w 1        ;width of cross section
   h 60        ;height
   r 75        ;inner radius
   segs 80        ;number of segments
   )
 ; prepare the screen
 (command "vpoint" "1,1,-1")
 (command "box" (list (setq lx (+ r w h)) (setq ly (max w h)) lx)
           (list (- lx) (- ly) (- lx)))
 (command "zoom" "e")
 (entdel (entlast))
 (setq osmode (getvar "osmode"))
 (setvar "osmode" 0)
 (setq ang0 (/ PI segs)
   c0 (list (+ r (/ w 2.0)) 0 0)
   N0 (list
        (list r (/ h -2.0) 0)
        (list (+ r w) (/ h -2.0) 0)
        (list (+ r w) (/ h 2.0) 0)
        (list r (/ h 2.0) 0))
   ang1 (- ang0))
 (setq ss (ssadd))
 (repeat segs
   (setq ang1 (+ ang1 ang0)
     ang2 (+ ang1 ang0)
     N1 (tw_rot N0 c0 ang1)
     N2 (tw_rot N0 c0 ang2))
   (draw_solid N1 N2)
   (ssadd (entlast) ss)
   )
 (command "union" ss "")
 (setvar "osmode" osmode)
 (princ)
 )
 
(defun tw_rot (N c ang)
 ;twists a cross section N around C with angle ANG
 ;than rotates the twisted section around OY with angle 2*ANG
 (mapcar '(lambda (p)
        (list (* (car p) (sin (* 2.0 ang))) (cadr p) (* (car p) (cos (* 2.0 ang)))))
     (mapcar '(lambda (p) (polar c (+ ang (angle p c)) (distance p c))) N))
 )

(defun draw_solid (N1 N2 / maxx maxy maxz minx miny minz i j k)
 ; Draws the bounding box of the two consecutive cross sections N1 and N2
 (setq N12 (append N1 N2)
   maxx (apply 'max (mapcar 'car N12))
   minx (apply 'min (mapcar 'car N12))
   maxy (apply 'max (mapcar 'cadr N12))
   miny (apply 'min (mapcar 'cadr N12))
   maxz (apply 'max (mapcar 'caddr N12))
   minz (apply 'min (mapcar 'caddr N12)))
 (command "box" (list minx miny minz) (list maxx maxy maxz))
 ; The box is sliced according to the two sections
 (command "slice" "l" "" (car N1) (cadr N1) (caddr N1) (car N2))
 (command "slice" "l" "" (car N2) (cadr N2) (caddr N2) (car N1))
 (setq i -1)
 (repeat 4
   (setq i (1+ i))
   (setq j (if (= i 3) 0 (1+ i)))
   (setq k (if (= j 3) 0 (1+ j)))
   (command "slice" "l" "" (nth i N1) (nth i N2) (nth j N1) (nth k N1))
   (command "slice" "l" "" (nth j N1) (nth j N2) (nth i N2) (nth k N2))
   )
 )

*** editing ***

the "clean code":

;|    Solid Mobius strip
   mfuccaro@hotmail.com
------------------------------October, 2004 ----------|;

(defun c:mobius( / w h r ang0 ang1 ang2 c0 N0 N1 N2 segs lx ly ss)

 (setq w 1        ;width of cross section
   h 60        ;height
   r 75        ;inner radius
   segs 80        ;number of segments
   )
 ; prepare the screen
 (command "vpoint" "1,1,-1")
 (command "box" (list (setq lx (+ r w h)) (setq ly (max w h)) lx)
           (list (- lx) (- ly) (- lx)))
 (command "zoom" "e")
 (entdel (entlast))
 (setq osmode (getvar "osmode"))
 (setvar "osmode" 0)
 (setq ang0 (/ PI segs)
   c0 (list (+ r (/ w 2.0)) 0 0)
   N0 (list
        (list r (/ h -2.0) 0)
        (list (+ r w) (/ h -2.0) 0)
        (list (+ r w) (/ h 2.0) 0)
        (list r (/ h 2.0) 0))
   ang1 (- ang0))
 (setq ss (ssadd))
 (repeat segs
   (setq ang1 (+ ang1 ang0)
     ang2 (+ ang1 ang0)
     N1 (tw_rot N0 c0 ang1)
     N2 (tw_rot N0 c0 ang2))
   (draw_solid N1 N2)
   (ssadd (entlast) ss)
   )
 (command "union" ss "")
 (setvar "osmode" osmode)
 (princ)
 )
 
(defun tw_rot (N c ang)
 ;twists a cross section N around C with angle ANG
 ;than rotates the twisted section around OY with angle 2*ANG
 (mapcar '(lambda (p)
        (list (* (car p) (sin (* 2.0 ang))) (cadr p) (* (car p) (cos (* 2.0 ang)))))
     (mapcar '(lambda (p) (polar c (+ ang (angle p c)) (distance p c))) N))
 )

(defun draw_solid (N1 N2 / maxx maxy maxz minx miny minz i j k)
 ; Draws the bounding box of the two consecutive cross sections N1 and N2
 (setq N12 (append N1 N2)
   maxx (apply 'max (mapcar 'car N12))
   minx (apply 'min (mapcar 'car N12))
   maxy (apply 'max (mapcar 'cadr N12))
   miny (apply 'min (mapcar 'cadr N12))
   maxz (apply 'max (mapcar 'caddr N12))
   minz (apply 'min (mapcar 'caddr N12)))
 (command "box" (list minx miny minz) (list maxx maxy maxz))
 ; The box is sliced according to the two sections
 (command "slice" "l" "" (car N1) (cadr N1) (caddr N1) (car N2))
 (command "slice" "l" "" (car N2) (cadr N2) (caddr N2) (car N1))
 (setq i -1)
 (repeat 4
   (setq i (1+ i))
   (setq j (if (= i 3) 0 (1+ i)))
   (setq k (if (= j 3) 0 (1+ j)))
   (command "slice" "l" "" (nth i N1) (nth i N2) (nth j N1) (nth k N1))
   (command "slice" "l" "" (nth j N1) (nth j N2) (nth i N2) (nth k N2))
   )
 )

Edited by fuccaro
cleaning the character coding error
Link to comment
Share on other sites

  • 4 weeks later...
Guest stupens

Hello everyone!

 

I've just joined the CADTutor community and I must thank everyone for their efforts in passing on AutoCAD knowledge. Excellent website!

 

In particular, I want to thank Fuccaro for his Mobius Surface routine which has proven extremely useful.

 

However, I don't know a thing about the AutoLisp language; and I want to modify this routine to generate a Mobius Strip with an elliptical section instead of a circular one.

 

I need to create strips with both major and minor axis perpendicular to the folding point and be able to modify this dimensions. Any thoughts on how can this be accomplished?

 

Thanks in advance! :)

Link to comment
Share on other sites

Hello Stupens!

I thought that the Mobius strip is a theoretical thing -I am surprised to see this big interest. Well, I wrote the programs for fun and I provided no options for changing the shape, the radius and the other parameters. Changes must be operated in the program.

I will look what I can do but not these days. Sorry!

Link to comment
Share on other sites

OK, here it is!

The cross section is eliptycal.

But let's call it "Twisted thorus" or so because it is not a Mobius strip any more.

It is more complex as the previous one. As solid it would take forever to be generated, so I created it as a surface. It looks smoother too.

 

telto1.png

telto2.png

 

Just for fun:

telto3.png

; Twisted ELiptycal Thorus
;    [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email]
;------------------------------ November 2004 ----
(defun c:telto( / r0 r1 r2 sg a0 a1 l0 l1 osmode)
 (setq r0 (getreal "\nbase radius R0 ")
   r1 (getreal "    Major radius R1 ")
   r2 (getreal "    minor radius R2 "))
 (setq sg 40    ;surface quality
   a0 0.0 a1 (/ PI (1- sg) 0.5) st (list r0 0) l0 nil)
 (mapcar 'setvar '("osmode" "cmdecho") '(0 0))
 (command "3DMESH" sg sg)
 (setq osmode (getvar "OSMODE"))
 (repeat sg
   (setq l0 (cons (list (+ r0 (* r1 (cos (setq a0 (+ a0 a1))))) (* r2 (sin a0))) l0)))
; l0 contains the points of the ellipse
 (setq a0 0.0)
 (repeat sg
   (setq a0 (+ a0 a1) l1 nil)
   (foreach p l0
   (setq l1 (cons (polar st (+ (* 0.5 a0) (angle st p)) (distance st p)) l1))
     )
; l1 is the l0 cross section twised
   (foreach p l1
     (command (list (* (sin a0) (car p)) (cadr p) (* (cos a0) (car p))))
; l1 is rotated around OZ and sent to AutoCAD
     )
   )
 (setvar "OSMODE" osmode)
 )

*** editing ***

The cleaned code:

; Twisted ELiptycal Thorus
;    mfuccaro@hotmail.com
;------------------------------ November 2004 ----
(defun c:telto( / r0 r1 r2 sg a0 a1 l0 l1 osmode)
 (setq r0 (getreal "\nbase radius R0 ")
   r1 (getreal "    Major radius R1 ")
   r2 (getreal "    minor radius R2 "))
 (setq sg 40    ;surface quality
   a0 0.0 a1 (/ PI (1- sg) 0.5) st (list r0 0) l0 nil)
 (mapcar 'setvar '("osmode" "cmdecho") '(0 0))
 (command "3DMESH" sg sg)
 (setq osmode (getvar "OSMODE"))
 (repeat sg
   (setq l0 (cons (list (+ r0 (* r1 (cos (setq a0 (+ a0 a1))))) (* r2 (sin a0))) l0)))
; l0 contains the points of the ellipse
 (setq a0 0.0)
 (repeat sg
   (setq a0 (+ a0 a1) l1 nil)
   (foreach p l0
   (setq l1 (cons (polar st (+ (* 0.5 a0) (angle st p)) (distance st p)) l1))
     )
; l1 is the l0 cross section twised
   (foreach p l1
     (command (list (* (sin a0) (car p)) (cadr p) (* (cos a0) (car p))))
; l1 is rotated around OZ and sent to AutoCAD
     )
   )
 (setvar "OSMODE" osmode)
 )

Edited by fuccaro
cleaning the character coding error
Link to comment
Share on other sites

Guest stupens

Hello Fuccaro!

 

First of all I must say I look at your talent in awe and wonder...

How have you acquired all of this knowledge?

 

I thank you very much for your time and effort, but I must admit I didn't explain myself accurately:

 

...and I want to modify this routine to generate a Mobius Strip with an elliptical section instead of a circular one...
I used the term "section" meaning the plan of the strip instead of the cross section. Sorry, my mistake. :oops:

 

The kind of surfaces I need to model have an elliptical plan such as these:

 

Major_Axis.jpg

Minor_Axis.jpg

 

You might wonder why all the interest in Mobius Bands?

 

I'm an architecture student currently analizing the Max Reinhardt Haus project by Peter Eisenman. This project designed in 1992, unbuilt; is based upon the development of surfaces based on a Mobius Strip.

 

Max_Model.jpg

 

And this is the corresponding geometry at the core, in plan and elevation...

 

Max_Strip.jpg

 

Notice how the "interior ellipse" is off-centered from the "exterior" one?

If I can configure the strip, i'll be able to recreate the volume that defines the surface of the building. (if I can rotate the planes according to the constant turn of the band, that is...)

 

Anyway, this work is due next tuesday and I'm running short. I'm going to focus on finishing the rest of the analysis first and i'll leave the 3d model as a bonus if there's some extra time left.

 

Once again, thank you for your time and patience.

I'm sure the Twisted Torus will become famous...

 

Keep up the good work! 8)

Link to comment
Share on other sites

These are with rectangular cross section and eliptycal path:

 

telto4.png

telto5.png

(defun c:project( / r1 r2 w h sg l0 lt lr ld a0 a1 orig osmode)
; by Fuccaro Miklos -November 2005
;
 (setq r1 (getreal "\n minor radius ")
   r2 (getreal "   MAJOR radius ")
   w (* 0.5 (getreal "\nCROSS SECTION: width "))
   h (* 0.5 (getreal "   height")))
 (setq sg 100 tw0 (/ PI 4))
 ; sg = 3...256
 (setq l0 (list (list (- w) (- h))
        (list w (- h))
        (list w h)
        (list (- w) h))
; l0= point list; cross section in "neutral position"
   a1 (/ pi (1- sg)) a0 (- a1)
   orig '(0 0))
 (setq osmode (getvar "OSMODE"))
 (mapcar 'setvar '("cmdecho" "osmode") '(0 0))
 (command "3dmesh" sg 5)
 (repeat sg
   (setq a0 (+ a0 a1))
   (setq lt (mapcar '(lambda (p)
           (polar orig (+ (angle orig p) (* 0.5 a0) tw0) (distance orig p)))
            l0))
; lt=point list; the cross section is twisted
   (setq lr (mapcar '(lambda (p)
           (list (* (car p) (cos a0))
                 (cadr p)
                 (* (car p) (sin a0))))
            lt))
; lr=point list; the twisted cross section is rotated around OY
   (setq ld (mapcar '(lambda (p)
           (list (+ (car p) (* r1 (cos a0)))
                 (cadr p)
                 (+ (caddr p) (* r2 (sin a0)))))
            lr))
; ld=point list; lr moved in place
   (foreach p ld (command p))
   (command (car ld))
   )
 (setvar "osmode" osmode)
 )

*** editing ***

The cleaned code:

(defun c:project( / r1 r2 w h sg l0 lt lr ld a0 a1 orig osmode)
; by Fuccaro Miklos -November 2005
;
 (setq r1 (getreal "\n minor radius ")
   r2 (getreal "   MAJOR radius ")
   w (* 0.5 (getreal "\nCROSS SECTION: width "))
   h (* 0.5 (getreal "   height")))
 (setq sg 100 tw0 (/ PI 4))
 ; sg = 3...256
 (setq l0 (list (list (- w) (- h))
        (list w (- h))
        (list w h)
        (list (- w) h))
; l0= point list; cross section in "neutral position"
   a1 (/ pi (1- sg)) a0 (- a1)
   orig '(0 0))
 (setq osmode (getvar "OSMODE"))
 (mapcar 'setvar '("cmdecho" "osmode") '(0 0))
 (command "3dmesh" sg 5)
 (repeat sg
   (setq a0 (+ a0 a1))
   (setq lt (mapcar '(lambda (p)
           (polar orig (+ (angle orig p) (* 0.5 a0) tw0) (distance orig p)))
            l0))
; lt=point list; the cross section is twisted
   (setq lr (mapcar '(lambda (p)
           (list (* (car p) (cos a0))
                 (cadr p)
                 (* (car p) (sin a0))))
            lt))
; lr=point list; the twisted cross section is rotated around OY
   (setq ld (mapcar '(lambda (p)
           (list (+ (car p) (* r1 (cos a0)))
                 (cadr p)
                 (+ (caddr p) (* r2 (sin a0)))))
            lr))
; ld=point list; lr moved in place
   (foreach p ld (command p))
   (command (car ld))
   )
 (setvar "osmode" osmode)
 )

Edited by fuccaro
cleaning the character coding error
Link to comment
Share on other sites

  • 2 weeks later...

Mr Fuccaro. You have been defined so many ways in this forum. I would

say that you havent merely mastered the the craft of computer drawing

but that you are what I consider an artist. It is a privilege to to see what you can create and then give to others so freely.

Frank

Link to comment
Share on other sites

Dear Mr. Frank

I didn't offer the result of my work for free; you will have to spend your precious time to test my routines to see if they work for you. :)

Now serious: I tried to teach AutoCAD to draw things sometimes so easy to draw in other CAD programs. I find that the Lisp is a powerfully language and the AutoCAD-Lisp combination gives you even more power.

I feel good reading your appreciation, thank you!

Link to comment
Share on other sites

Mr Fuccaro,

I know this isnt the chat section but I am curious. If other drafting programs can do easily what you are doing inAutocad then why use

Autocad at all? Autocad is the the only drafting software I have access to.

Are you saying the other ones are superior to straight Autocad, but

Autocad coupled with lisp routones is superior to the others?

Frank

Link to comment
Share on other sites

If other drafting programs can do easily what you are doing inAutocad then why use Autocad at all? Autocad is the the only drafting software I have access to.

Frank, you posted a question AND the answer too!

Are you saying the other ones are superior to straight Autocad [...]?

Ask Mr T! :D

My answer:

AutoCAD can be used in many fields. It is a general CAD software -created initially for architects. I do mechanical jobs and I see others working in Catia, SolidWorks and ProEngineering. I see things I can not do in AutoCAD but these things are also a source for inspiration for my Lisp routines.

Autocad coupled with lisp routones is superior to the others?

Let me quote Hendie for the answer:

Yes, Anything (almost) is possible if you have enough time and energy and knowledge to see it through.
Mr Fuccaro

You are a family member now. Call me simple: Sir! :D

Link to comment
Share on other sites

  • 5 months later...

Hi,

 

Does anyone know of a way to export all the points of a mobius mesh or mobius solid to a text file?

 

Thanks

 

Moesian

Link to comment
Share on other sites

Two ways coming up in my mind:

1. Modify the existing routine to write the points in a file as it calculates them

2. To write a lisp to export the points from a mesh. To export the solid points is more complicated.

 

Try this:

;        MOEBIUS SURFACE    
;      [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email] 
;;;;;;;;;;;;- 21.05.2003 -;
; revisions: save the points in a text file  May 2005
;
(defun c:mb( / file xmax ymax x y x1 y1 z1 x2 y2 z2 rad2 save ang2)
 (setq file (open (getfiled "Output file" "" "TXT" 5) "w"))
 (setq xmax 50 ymax 5    ;you may change here the dimensions 
  x 0 rad2 (/ xmax (* 2 PI)) 
  save (list (getvar "osmode") (getvar "cmdecho"))) 
 (setvar "cmdecho" 0) 
 (setvar "osmode" 0) 
 (command "3dmesh" (1+ xmax) ymax) 
 (repeat (1+ xmax) 
   (setq y (- (/ ymax 2))) 
   (repeat ymax 
     (setq ang1 (/ (* x PI) xmax)     ;twist along OY 
      x1 x 
      y1 (* y (cos ang1)) 
      z1 (* y (sin ang1))) 
     (setq ang2 (/ (* x1 2 PI) xmax)  ;bend on OZ 
      x2 (* rad2 (sin ang2)) 
      y2 y1 
      z2 (* (+ rad2 z1) (cos ang2))) 
     (command (list x2 y2 z2))
     (write-line (strcat (rtos x2) "," (rtos y2) "," (rtos z2)) file)
     (setq y (1+ y))) 
   (setq x (1+ x)))
 (close file)
 (command "vpoint" (list 1 1 1)) 
 (setvar "osmode" (car save)) 
 (setvar "cmdecho" (cadr save)) 
 (princ) 
 )

*** editing ***

The clean code:

;        MOBIUS SURFACE    
;      mfuccaro@hotmail.com 
;;;;;;;;;;;;- 21.05.2003 -;
; revisions: save the points in a text file  May 2005
;
(defun c:mb( / file xmax ymax x y x1 y1 z1 x2 y2 z2 rad2 save ang2)
 (setq file (open (getfiled "Output file" "" "TXT" 5) "w"))
 (setq xmax 50 ymax 5    ;you may change here the dimensions 
  x 0 rad2 (/ xmax (* 2 PI)) 
  save (list (getvar "osmode") (getvar "cmdecho"))) 
 (setvar "cmdecho" 0) 
 (setvar "osmode" 0) 
 (command "3dmesh" (1+ xmax) ymax) 
 (repeat (1+ xmax) 
   (setq y (- (/ ymax 2))) 
   (repeat ymax 
     (setq ang1 (/ (* x PI) xmax)     ;twist along OY 
      x1 x 
      y1 (* y (cos ang1)) 
      z1 (* y (sin ang1))) 
     (setq ang2 (/ (* x1 2 PI) xmax)  ;bend on OZ 
      x2 (* rad2 (sin ang2)) 
      y2 y1 
      z2 (* (+ rad2 z1) (cos ang2))) 
     (command (list x2 y2 z2))
     (write-line (strcat (rtos x2) "," (rtos y2) "," (rtos z2)) file)
     (setq y (1+ y))) 
   (setq x (1+ x)))
 (close file)
 (command "vpoint" (list 1 1 1)) 
 (setvar "osmode" (car save)) 
 (setvar "cmdecho" (cadr save)) 
 (princ) 
 )

Edited by fuccaro
cleaning the character coding error
Link to comment
Share on other sites

Cheers fuccaro,

 

Havent tried this yet but looks like its what I need. Think I might have a go at trying to get the solid point export lisp done myself. Not sure if ill succeed but Ill post it here if I do. Havent really got any experience with lisp so looks bleek. Do you know of any good tutorials on Autolisp programming?

Link to comment
Share on other sites

Cheers fuccaro,

[...] looks like its what I need.

Good! Just for my curiousity: what do you need?

For learning Lisp try the Afralisp site.

Link to comment
Share on other sites

  • 3 years later...

Welcome in the forum, Gilbert!

I wrote the Mobius lisp in the dark era of pre2007 AutoCAD. These days people may use Loft and Sweep, this brought major changes in modelling, including the possibility to draw a Mobius strip just from AutoCAD.

But if you wish to play: see the routine I posted years ago, on the first page of this thread. Also CADTutor published instructions about how to use Lisp routines. In the routine itself are some instructions about changing the dimensions of the Mobius strip. So... draw one and scale it until it fits your needs. Good luck, post again if you have problems.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...