Jump to content

Recommended Posts

Posted

does anyone has a lisp to spare to draw an Isometric Polygons?

what i do is make an Isometric Circle, Divide the circle into parts, trace the nodes, erase the circle and nodes and there's my polygon.

  • Replies 31
  • Created
  • Last Reply

Top Posters In This Topic

  • nod684

    11

  • pBe

    10

  • Lee Mac

    5

  • marko_ribar

    5

Top Posters In This Topic

Posted Images

Posted

If I understand correctly, your isometric circle is an ellipse.

Are your divisions all of equal length?

 

If so, the distinguished Lee Mac has an excellent program that will equally segment circles and ellipses (and others) into equal length segments.

I regularly use this program. I am sure Lee will not mind me directing you to this. Thanks Lee. :beer:

 

Can be found on Lee's site here: -

 

http://lee-mac.com/segmentcurve.html

Posted
If I understand correctly, your isometric circle is an ellipse.

Are your divisions all of equal length?

 

If so, the distinguished Lee Mac has an excellent program that will equally segment circles and ellipses (and others) into equal length segments.

I regularly use this program. I am sure Lee will not mind me directing you to this. Thanks Lee. :beer:

 

Can be found on Lee's site here: -

 

http://lee-mac.com/segmentcurve.html

 

Thanks for the reply wolf. Yes...i have it is an ellipse

what am looking for sana is a lisp that will prompt me for how many sides will the polygon be and input the diameter agad.

 

But this helps too. Thanks a lot!

Posted

Maybe, this :

 

(defun transptiso (pt)
 (list (+ (car (polar (list 0.0 0.0 0.0) (/ pi 6.0) (car pt))) 
       (car (polar (list 0.0 0.0 0.0) (* 5.0 (/ pi 6.0)) (cadr pt))) )

       (+ (cadr (polar (list 0.0 0.0 0.0) (/ pi 6.0) (car pt))) 
       (cadr (polar (list 0.0 0.0 0.0) (* 5.0 (/ pi 6.0)) (cadr pt))) )

       0.0
 )
)

(defun c:isopolygon (/ pol vertlst vertlstn)
 (vl-cmdf "_.ucs" "w")
 (vl-cmdf "_.plan" "")
 (vl-cmdf "_.zoom" "c" "0,0,0" "")
 (vl-cmdf "_.polygon" pause "0,0,0" pause pause)
 (setq pol (entlast))
 (mapcar '(lambda (x) (if (= (car x) 10) (setq vertlst (cons (cdr x) vertlst)))) (entget pol))
 (setq vertlst (reverse vertlst)) 
 (setq vertlstn (mapcar '(lambda (p) (transptiso p)) vertlst))
 (entmake 
   (append
     (list
       '(0 . "LWPOLYLINE")
       '(100 . "AcDbEntity")
       '(100 . "AcDbPolyline")
       (cons 90 (length vertlstn))
       '(70 . 1)
     )
     (mapcar '(lambda (x) (cons 10 x)) vertlstn)
     (list (list 210 0.0 0.0 1.0))
   )
 )
 (entdel pol)
 (vl-cmdf "_.ucs" "p")
 (princ)
)

 

M.R.

Posted
Thanks for the reply wolf. Yes...i have it is an ellipse

what am looking for sana is a lisp that will prompt me for how many sides will the polygon be and input the diameter agad.

 

But this helps too. Thanks a lot!

 

Sounds easy enough. :)

 

Not sure if what you need is the same as what i have in mind. can you post an image of the desired result?

Posted

Hi M.R.

tried using your routine but i think have some error as the resulting polygon is not Isometric

 

pBe, image attached

IsoPoly.jpg

Posted

Turn polar tracking to 45 degrees, and while executing routine make 6 sided polygon with "Inscribed" option with angle 135 degree... You'll get what you posted - conventional way... My code does draw isometric polygon - see my attached jpg...

 

M.R.

hexaiso.jpg

Posted

pBe, image attached

 

Conventional way means the isocircles are existing?

Posted

I don't think 'isometric' is the correct term to describe the result that the OP is looking to obtain, which may be misleading those who are attempting to provide a solution; that said, I'm not sure that I completely understand the desired result.

Posted
I don't think 'isometric' is the correct term to describe the result that the OP is looking to obtain, which may be misleading those who are attempting to provide a solution; that said, I'm not sure that I completely understand the desired result.

 

Indeed it does shows an odd shape polygon, i attempted to write a code based on the description on the first post, (granting the isocircles are existing)

 

(defun  c:sample (/ objell sides seg seg2 pts)
 (vl-load-com)
 (setq objell  (car (entsel)))
 (setq sides (getint "\nEnter number of sides"))
 (setq  seg  (/ (vlax-curve-getdistatparam
             objell
             (vlax-curve-getendparam objell)
             )
           sides
           ) seg2 0.0
   )
 (repeat sides
   (setq
     pts
      (cons (vlax-curve-getpointatdist objell (+ seg seg2)) pts)
     )
   (setq seg2 (+ seg seg2))
   )
 (command "_Pline" "_non")
 (foreach pt (cons (last pts) pts) (command pt))
 (command)
 (entdel objell)
 (princ)
 )

 

My guess is this thread has something to do with the OP's post on another forum. creating isocircles oriented on Top/Left/Right

 

http://www.theswamp.org/index.php?topic=42737.0

Posted
Turn polar tracking to 45 degrees, and while executing routine make 6 sided polygon with "Inscribed" option with angle 135 degree... You'll get what you posted - conventional way... My code does draw isometric polygon - see my attached jpg...

 

M.R.

 

 

Conventional way means the isocircles are existing?

 

I don't think 'isometric' is the correct term to describe the result that the OP is looking to obtain, which may be misleading those who are attempting to provide a solution; that said, I'm not sure that I completely understand the desired result.

 

Sorry if i mislead you guys

 

i have attached a sample image of how the polygon should look when in Isometric Plane (Cube) the ellipse are not existing, they're just my guides for me to be able to divide and connect the nodes to form the polygon

isometric.jpg

Posted
Indeed it does shows an odd shape polygon, i attempted to write a code based on the description on the first post, (granting the isocircles are existing)

 

(defun  c:sample (/ objell sides seg seg2 pts)
 (vl-load-com)
 (setq objell  (car (entsel)))
 (setq sides (getint "\nEnter number of sides"))
 (setq  seg  (/ (vlax-curve-getdistatparam
             objell
             (vlax-curve-getendparam objell)
             )
           sides
           ) seg2 0.0
   )
 (repeat sides
   (setq
     pts
      (cons (vlax-curve-getpointatdist objell (+ seg seg2)) pts)
     )
   (setq seg2 (+ seg seg2))
   )
 (command "_Pline" "_non")
 (foreach pt (cons (last pts) pts) (command pt))
 (command)
 (entdel objell)
 (princ)
 )

My guess is this thread has something to do with the OP's post on another forum. creating isocircles oriented on Top/Left/Right

 

http://www.theswamp.org/index.php?topic=42737.0

 

yes it has something to do with that code pBe..

 

i have tried this routine and this is what i got.

 

no...ellipse are not existing

isometric-2.jpg

Posted

Here is an example using a transformation matrix to map the vertices:

 

[color=GREEN];; Isometric Projection Example  -  Lee Mac[/color]

([color=BLUE]defun[/color] c:iso ( [color=BLUE]/[/color] c e l m p q v )
   ([color=BLUE]initget[/color] 1 [color=MAROON]"Top Right Left"[/color])
   ([color=BLUE]setq[/color] m
       (mxs
           ([color=BLUE]cdr[/color]
               ([color=BLUE]assoc[/color] ([color=BLUE]getkword[/color] [color=MAROON]"\nSpecify Isometric Projection Plane [Top/Right/Left]: "[/color])
                   ([color=BLUE]list[/color]
                       ([color=BLUE]list[/color] [color=MAROON]"Top"[/color]   ([color=BLUE]list[/color] ([color=BLUE]sqrt[/color] 3.0) ([color=BLUE]sqrt[/color] 3.0)) '(-1.0 1.0))
                       ([color=BLUE]list[/color] [color=MAROON]"Right"[/color] ([color=BLUE]list[/color] ([color=BLUE]sqrt[/color] 3.0)     0.0   ) '( 1.0 2.0))
                       ([color=BLUE]list[/color] [color=MAROON]"Left"[/color]  ([color=BLUE]list[/color] ([color=BLUE]sqrt[/color] 3.0)     0.0   ) '(-1.0 2.0))
                   )
               )
           )
           0.5 [color=GREEN];(/ (sqrt 6.0) 6.0) ;; True projection[/color]
       )
   )
   ([color=BLUE]while[/color]
       ([color=BLUE]progn[/color] ([color=BLUE]setvar[/color] 'errno 0) ([color=BLUE]setq[/color] e ([color=BLUE]car[/color] ([color=BLUE]entsel[/color] [color=MAROON]"\nSelect LWPolyline: "[/color])))
           ([color=BLUE]cond[/color]
               (   ([color=BLUE]=[/color] 7 ([color=BLUE]getvar[/color] 'errno))
                   ([color=BLUE]princ[/color] [color=MAROON]"\nMissed, try again."[/color])
               )
               (   ([color=BLUE]=[/color] 'ename ([color=BLUE]type[/color] e))
                   ([color=BLUE]if[/color] ([color=BLUE]/=[/color] [color=MAROON]"LWPOLYLINE"[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 0 ([color=BLUE]entget[/color] e))))
                       ([color=BLUE]princ[/color] [color=MAROON]"\nInvalid object selected."[/color])
                   )
               )
           )
       )
   )
   ([color=BLUE]if[/color] e
       ([color=BLUE]progn[/color]
           ([color=BLUE]setq[/color] e ([color=BLUE]entget[/color] e)
                 l (LM:massoc 10 e)
                 q ([color=BLUE]length[/color] l)
                 c ([color=BLUE]mapcar[/color] '[color=BLUE]/[/color] ([color=BLUE]apply[/color] '[color=BLUE]mapcar[/color] ([color=BLUE]cons[/color] '[color=BLUE]+[/color] l)) ([color=BLUE]list[/color] q q))
                 v ([color=BLUE]mapcar[/color] '[color=BLUE]-[/color] c (mxv m c))
           )
           ([color=BLUE]entmake[/color]
               ([color=BLUE]append[/color]
                   ([color=BLUE]list[/color]
                      '(0 . [color=MAROON]"LWPOLYLINE"[/color])
                      '(100 . [color=MAROON]"AcDbEntity"[/color])
                      '(100 . [color=MAROON]"AcDbPolyline"[/color])
                       ([color=BLUE]assoc[/color] 90 e)
                       ([color=BLUE]assoc[/color] 70 e)
                       ([color=BLUE]assoc[/color] 38 e)
                   )
                   ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( p ) ([color=BLUE]cons[/color] 10 ([color=BLUE]mapcar[/color] '[color=BLUE]+[/color] (mxv m p) v))) l)
                   ([color=BLUE]list[/color] ([color=BLUE]assoc[/color] 210 e))
               )
           )
       )
   )
   ([color=BLUE]princ[/color])
)

[color=GREEN];; MAssoc  -  Lee Mac[/color]
[color=GREEN];; Returns all associations of a key in an association list[/color]

([color=BLUE]defun[/color] LM:MAssoc ( key lst [color=BLUE]/[/color] item )
   ([color=BLUE]if[/color] ([color=BLUE]setq[/color] item ([color=BLUE]assoc[/color] key lst))
       ([color=BLUE]cons[/color] ([color=BLUE]cdr[/color] item) (LM:MAssoc key ([color=BLUE]cdr[/color] ([color=BLUE]member[/color] item lst))))
   )
)

[color=GREEN];; Matrix x Vector  -  Vladimir Nesterovsky[/color]
[color=GREEN];; Args: m - nxn matrix, v - vector in R^n[/color]

([color=BLUE]defun[/color] mxv ( m v )
   ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( r ) ([color=BLUE]apply[/color] '[color=BLUE]+[/color] ([color=BLUE]mapcar[/color] '[color=BLUE]*[/color] r v))) m)
)

[color=GREEN];; Matrix x Scalar - Lee Mac 2010[/color]
[color=GREEN];; Args: m - nxn matrix, n - real scalar[/color]

([color=BLUE]defun[/color] mxs ( m s )
   ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( r ) ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( n ) ([color=BLUE]*[/color] n s)) r)) m)
)

([color=BLUE]princ[/color])

isomap.png

 

Note that the above example is not a true projection since the dimensions are preserved; uncomment the noted scale factor in the code to obtain the true projective dimensions.

Posted
yes it has something to do with that code pBe..

 

i have tried this routine and this is what i got.

 

 

I suspect you have osnaps on, i should have used entmake instead of the command equivalent, anyhoo.. we can incorporate your code from the swamp to draw the ellipse AND polygon after specifying diameter and insertion point by order of Top/Right/Left.

Posted

@MR;

tried your code again. and yes you're right. it is in isometric TOP mode, however if i change to either left or right, it still projects the Top Isocircle.

i like this code coz no need to have pre-drawn polygon or ellipse

 

@Lee;

thanks for the help Lee. amazed at how you were able to "rotate" the 2d Polygon into Isometric View. This does help a lot too! Just need to draw the polygon first before projecting them into isometric...but still is cool!

 

@pBe

Yes i have OSNAPS turned ON

Posted

@pBe

Yes i have OSNAPS turned ON

 

that explains the resulting "not-even-close polygon" , What i'm suggesting to you before is to modify your isoc routine to include creation of polygon one after the other.

Posted (edited)

Here is my improved version to fit your needs :

 

(defun transptisotop (pt)
 (list (+ (car (polar (list 0.0 0.0 0.0) (/ pi 6.0) (car pt))) 
       (car (polar (list 0.0 0.0 0.0) (* 5.0 (/ pi 6.0)) (cadr pt))) )

       (+ (cadr (polar (list 0.0 0.0 0.0) (/ pi 6.0) (car pt))) 
       (cadr (polar (list 0.0 0.0 0.0) (* 5.0 (/ pi 6.0)) (cadr pt))) )

       0.0
 )
)

(defun transptisoleft (pt)
 (list (+ (car (polar (list 0.0 0.0 0.0) (- (/ pi 6.0)) (car pt))) 
       (car (polar (list 0.0 0.0 0.0) (/ pi 2.0) (cadr pt))) )

       (+ (cadr (polar (list 0.0 0.0 0.0) (- (/ pi 6.0)) (car pt))) 
       (cadr (polar (list 0.0 0.0 0.0) (/ pi 2.0) (cadr pt))) )

       0.0
 )
)

(defun transptisoright (pt)
 (list (+ (car (polar (list 0.0 0.0 0.0) (- (* 5.0 (/ pi 6.0))) (car pt))) 
       (car (polar (list 0.0 0.0 0.0) (/ pi 2.0) (cadr pt))) )

       (+ (cadr (polar (list 0.0 0.0 0.0) (- (* 5.0 (/ pi 6.0))) (car pt))) 
       (cadr (polar (list 0.0 0.0 0.0) (/ pi 2.0) (cadr pt))) )

       0.0
 )
)

(defun isotop (vertlst squarelst ptci1 ptci2)
 (setq vertlstn (mapcar '(lambda (p) (transptisotop p)) vertlst))
 (setq isopoltop (entmakex 
                   (append
                     (list
                       '(0 . "LWPOLYLINE")
                       '(100 . "AcDbEntity")
                       '(100 . "AcDbPolyline")
                        (cons 90 (length vertlstn))
                       '(70 . 1)
                     )
                     (mapcar '(lambda (x) (cons 10 x)) vertlstn)
                     (list (list 210 0.0 0.0 1.0))
                   )
                 )
 )
 (setq sqarelstn (mapcar '(lambda (p) (transptisotop p)) squarelst))
 (setq isosquaretop (entmakex 
                      (append
                        (list
                          '(0 . "LWPOLYLINE")
                          '(100 . "AcDbEntity")
                          '(100 . "AcDbPolyline")
                           (cons 90 (length sqarelstn))
                          '(70 . 1)
                        )
                        (mapcar '(lambda (x) (cons 10 x)) sqarelstn)
                        (list (list 210 0.0 0.0 1.0))
                      )
                    )
 )
 (setq pta (transptisotop ptci1))
 (setq ptb (transptisotop ptci2))
 (setq ra (distance '(0.0 0.0 0.0) pta))
 (setq rb (distance '(0.0 0.0 0.0) ptb))
 (setq isocircletop (entmakex
                      (list
                        '(0 . "ELLIPSE")
                        '(100 . "AcDbEntity")
                        '(100 . "AcDbEllipse")
                        (cons 10 (list 0.0 0.0 0.0))
                        (cons 11 pta)
                        (list 210 0.0 0.0 1.0)
                        (cons 40 (/ rb ra))
                        '(41 . 0.0)
                        (cons 42 (* 2.0 pi))
                      )
                    )
 )
)

(defun isoleft (vertlst squarelst ptci1 ptci2)
 (setq vertlstn (mapcar '(lambda (p) (transptisoleft p)) vertlst))
 (setq isopolleft (entmakex 
                    (append
                      (list
                        '(0 . "LWPOLYLINE")
                        '(100 . "AcDbEntity")
                        '(100 . "AcDbPolyline")
                         (cons 90 (length vertlstn))
                        '(70 . 1)
                      )
                      (mapcar '(lambda (x) (cons 10 x)) vertlstn)
                      (list (list 210 0.0 0.0 1.0))
                    )
                  )
 )
 (setq sqarelstn (mapcar '(lambda (p) (transptisoleft p)) squarelst))
 (setq isosquareleft (entmakex 
                       (append
                         (list
                           '(0 . "LWPOLYLINE")
                           '(100 . "AcDbEntity")
                           '(100 . "AcDbPolyline")
                            (cons 90 (length sqarelstn))
                           '(70 . 1)
                         )
                         (mapcar '(lambda (x) (cons 10 x)) sqarelstn)
                         (list (list 210 0.0 0.0 1.0))
                       )
                     )
 )
 (setq pta (transptisoleft ptci1))
 (setq ptb (transptisoleft ptci2))
 (setq ra (distance '(0.0 0.0 0.0) pta))
 (setq rb (distance '(0.0 0.0 0.0) ptb))
 (setq isocircleleft (entmakex
                       (list
                         '(0 . "ELLIPSE")
                         '(100 . "AcDbEntity")
                         '(100 . "AcDbEllipse")
                         (cons 10 (list 0.0 0.0 0.0))
                         (cons 11 pta)
                         (list 210 0.0 0.0 1.0)
                         (cons 40 (/ rb ra))
                         '(41 . 0.0)
                         (cons 42 (* 2.0 pi))
                       )
                     )
 )
)

(defun isoright (vertlst squarelst ptci1 ptci2)
 (setq vertlstn (mapcar '(lambda (p) (transptisoright p)) vertlst))
 (setq isopolright (entmakex 
                     (append
                       (list
                         '(0 . "LWPOLYLINE")
                         '(100 . "AcDbEntity")
                         '(100 . "AcDbPolyline")
                          (cons 90 (length vertlstn))
                         '(70 . 1)
                       )
                       (mapcar '(lambda (x) (cons 10 x)) vertlstn)
                       (list (list 210 0.0 0.0 1.0))
                     )
                   )
 )
 (setq sqarelstn (mapcar '(lambda (p) (transptisoright p)) squarelst))
 (setq isosquareright (entmakex 
                        (append
                          (list
                            '(0 . "LWPOLYLINE")
                            '(100 . "AcDbEntity")
                            '(100 . "AcDbPolyline")
                             (cons 90 (length sqarelstn))
                            '(70 . 1)
                          )
                          (mapcar '(lambda (x) (cons 10 x)) sqarelstn)
                          (list (list 210 0.0 0.0 1.0))
                        )
                      )
 )
 (setq pta (transptisoright ptci1))
 (setq ptb (transptisoright ptci2))
 (setq ra (distance '(0.0 0.0 0.0) pta))
 (setq rb (distance '(0.0 0.0 0.0) ptb))
 (setq isocircleright (entmakex
                        (list
                          '(0 . "ELLIPSE")
                          '(100 . "AcDbEntity")
                          '(100 . "AcDbEllipse")
                          (cons 10 (list 0.0 0.0 0.0))
                          (cons 11 pta)
                          (list 210 0.0 0.0 1.0)
                          (cons 40 (/ rb ra))
                          '(41 . 0.0)
                          (cons 42 (* 2.0 pi))
                        )
                      )
 )
)

(defun c:isopolygon (/ pol vertlst rad ptci1 ptci2 squarelst ch)
 (vl-cmdf "_.ucs" "w")
 (vl-cmdf "_.plan" "")
 (vl-cmdf "_.zoom" "c" "0,0,0" "")
 (vl-cmdf "_.polygon" pause "0,0,0" "I" pause)
 (setq pol (entlast))
 (mapcar '(lambda (x) (if (= (car x) 10) (setq vertlst (cons (cdr x) vertlst)))) (entget pol))
 (setq vertlst (reverse vertlst))
 (setq rad (distance '(0.0 0.0 0.0) (car vertlst)))
 (setq ptci1 (polar '(0.0 0.0 0.0) (- (/ pi 4.0)) rad))
 (setq ptci2 (polar '(0.0 0.0 0.0) (/ pi 4.0) rad))
 (setq squarelst (list (list (- rad) (- rad) 0.0) (list rad (- rad) 0.0) (list rad rad 0.0) (list (- rad) rad 0.0)))
 (initget "Top Left Right All")
 (setq ch (getkword "\nEnter Top/Left/Right <All> : "))
 (cond ((or (eq ch "All") (null ch))
        (isotop vertlst squarelst ptci1 ptci2)
        (setq sstop (ssadd))
        (ssadd isopoltop sstop)
        (ssadd isosquaretop sstop)
        (ssadd isocircletop sstop)
        (vl-cmdf "_.move" sstop "" (cdr (assoc 10 (entget isosquaretop))) '(0.0 0.0 0.0) )
        (isoleft vertlst squarelst ptci1 ptci2)
        (setq ssleft (ssadd))
        (ssadd isopolleft ssleft)
        (ssadd isosquareleft ssleft)
        (ssadd isocircleleft ssleft)
        (vl-cmdf "_.move" ssleft "" '(0.0 0.0 0.0) (cdr (assoc 10 (entget isosquareleft))) )
        (isoright vertlst squarelst ptci1 ptci2)
        (setq ssright (ssadd))
        (ssadd isopolright ssright)
        (ssadd isosquareright ssright)
        (ssadd isocircleright ssright)
        (vl-cmdf "_.move" ssright "" '(0.0 0.0 0.0) (cdr (assoc 10 (entget isosquareright))) )
       )
       ((eq ch "Top")
        (isotop vertlst squarelst ptci1 ptci2)
       )
       ((eq ch "Left")
        (isoleft vertlst squarelst ptci1 ptci2)
       )
       ((eq ch "Right")
        (isoright vertlst squarelst ptci1 ptci2)
       )
 )
 (entdel pol)
 (vl-cmdf "_.ucs" "p")
 (princ)
)

M.R.

Edited by marko_ribar
code changed to match OP's posted image
Posted (edited)

Here is another version using the equation of the ellipse, based on the active isoplane:

 

IsoPoly.gif

[color=GREEN];;------------------=={ Isometric Polygon }==-----------------;;[/color]
[color=GREEN];;                                                            ;;[/color]
[color=GREEN];;  Enables the user to construct a regular polygon projected ;;[/color]
[color=GREEN];;  in the active isometric plane.                            ;;[/color]
[color=GREEN];;------------------------------------------------------------;;[/color]
[color=GREEN];;  Author: Lee Mac, Copyright © 2012 - www.lee-mac.com       ;;[/color]
[color=GREEN];;------------------------------------------------------------;;[/color]

([color=BLUE]defun[/color] c:isopoly ( [color=BLUE]/[/color] a b c i l m p r s )
   ([color=BLUE]if[/color] ([color=BLUE]null[/color] n) ([color=BLUE]setq[/color] n 6))
   ([color=BLUE]while[/color]
       ([color=BLUE]<[/color] ([color=BLUE]setq[/color] n ([color=BLUE]cond[/color] (([color=BLUE]getint[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\nSpecify Number of Sides <"[/color] ([color=BLUE]itoa[/color] n) [color=MAROON]">: "[/color]))) ( n ))) 3)
       ([color=BLUE]princ[/color] [color=MAROON]"\nRequires an integer greater than or equal to 3."[/color])
   )
   ([color=BLUE]if[/color] ([color=BLUE]and[/color] ([color=BLUE]setq[/color] c ([color=BLUE]getpoint[/color] [color=MAROON]"\nSpecify Center of Polygon: "[/color]))
            ([color=BLUE]progn[/color]
                ([color=BLUE]initget[/color] 6)
                ([color=BLUE]setq[/color] r ([color=BLUE]getdist[/color] c [color=MAROON]"\nSpecify Radius: "[/color]))
            )
       )
       ([color=BLUE]progn[/color]
           ([color=BLUE]setq[/color] a ([color=BLUE]/[/color] ([color=BLUE]sqrt[/color] 3.0) ([color=BLUE]sqrt[/color] 2.0))
                 b ([color=BLUE]/[/color] 1.0 ([color=BLUE]sqrt[/color] 2.0))
                 i ([color=BLUE]/[/color] ([color=BLUE]+[/color] [color=BLUE]pi[/color] [color=BLUE]pi[/color]) n)
                 c ([color=BLUE]trans[/color] c 1 0)
                 p ([color=BLUE]/[/color] [color=BLUE]pi[/color] 3.0)
                 s 0.0
           )
           ([color=BLUE]repeat[/color] n
               ([color=BLUE]setq[/color] l ([color=BLUE]cons[/color] ([color=BLUE]list[/color] ([color=BLUE]*[/color] a r ([color=BLUE]cos[/color] s)) ([color=BLUE]*[/color] b r ([color=BLUE]sin[/color] s))) l)
                     s ([color=BLUE]+[/color] i s)
               )
           )
           ([color=BLUE]setq[/color] m
               ([color=BLUE]cdr[/color]
                   ([color=BLUE]assoc[/color] ([color=BLUE]getvar[/color] 'snapisopair)
                       ([color=BLUE]list[/color]
                           ([color=BLUE]list[/color] 0 ([color=BLUE]list[/color] ([color=BLUE]cos[/color] p) ([color=BLUE]sin[/color] p)) ([color=BLUE]list[/color] ([color=BLUE]sin[/color] ([color=BLUE]-[/color] p)) ([color=BLUE]cos[/color] p)))
                          '(1 (1.0 0.0) (0.0 1.0))
                           ([color=BLUE]list[/color] 2 ([color=BLUE]list[/color] ([color=BLUE]cos[/color] p) ([color=BLUE]sin[/color] ([color=BLUE]-[/color] p))) ([color=BLUE]list[/color] ([color=BLUE]sin[/color] p) ([color=BLUE]cos[/color] p)))
                       )
                   )
               )
           )
           ([color=BLUE]entmake[/color]
               ([color=BLUE]append[/color]
                   ([color=BLUE]list[/color]
                      '(0 . [color=MAROON]"LWPOLYLINE"[/color])
                      '(100 . [color=MAROON]"AcDbEntity"[/color])
                      '(100 . [color=MAROON]"AcDbPolyline"[/color])
                       ([color=BLUE]cons[/color] 90 n)
                      '(70 . 1)
                   )
                   ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( p ) ([color=BLUE]cons[/color] 10 ([color=BLUE]mapcar[/color] '[color=BLUE]+[/color] (mxv m p) c))) l)
               )
           )
       )
   )
   ([color=BLUE]princ[/color])
)

[color=GREEN];; Matrix x Vector  -  Vladimir Nesterovsky[/color]
[color=GREEN];; Args: m - nxn matrix, v - vector in R^n[/color]

([color=BLUE]defun[/color] mxv ( m v )
   ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( r ) ([color=BLUE]apply[/color] '[color=BLUE]+[/color] ([color=BLUE]mapcar[/color] '[color=BLUE]*[/color] r v))) m)
)
([color=BLUE]princ[/color])

Edited by Lee Mac
Posted

If I may notice, what's the purpose of your code Lee?... I've updated mine to match OP's image and with your code projected polygon isn't in correct scale and you haven't included options for Top,Left,Right,All projections (maybe I am missing something - your variant with matrix is much advanced than mine, but all this is really necessary)?

 

M.R.

Posted (edited)
...with your code projected polygon isn't in correct scale and you haven't included options for Top,Left,Right,All projections

 

Sorry, I forgot to include the polygon radius multiplier - I have since updated the above code and have also included a short demonstration.

 

However, I would state that the original program would construct the polygon in each of the isometric planes (based on the active isoplane, as shown in the above animation).

Edited by Lee Mac

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...