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

Modify 3D Solid dimensions via Lisp or .NET

7 REPLIES 7
Reply
Message 1 of 8
doaiena
2503 Views, 7 Replies

Modify 3D Solid dimensions via Lisp or .NET

Hello,

Ive been trying to find a way to modify the dimensions of a 3D Solid for weeks now, but with no luck. The thing im trying to do is:
1. Select a solid
2. Get current dimensions X Y Z
3. Enter new dimensions X Y Z

 

So far ive managed doing that on rectangular solids by deleting the old solid and creating a new one at the same center point with the new dimensions. But if i have a fillet or some boolean operation done on the solid, this method cant work.

So my question is: Can i modify the dimensions of an existing solid by either lisp or even .NET. Is it possible at all.

Thank you in advance.

7 REPLIES 7
Message 2 of 8
marko_ribar
in reply to: doaiena

You can try to replace your 3D SOLID with block with insertion point at 3D SOLID Centroid and place that block with 1,1,1 slace factors with rotation 0.0... Then you can edit its axises scale factors, but unfortunately those kind of blocks are not possible to explode, so you can't have your 3D SOLID modified - only you can have its block presentation which you can successful import into some other 3D applications like 3DS MAX, but still you'll lose some geometry characteristics by setting up importing options for converting DWG entites into MAXs tessalated mesh objects... I've explained what you can do with MAX, but for other applications, you'll have to experiment on your own... Maybe smooth geometry properties of 3D SOLID surfaces is possible to preserve when using some other software similar to ACAD...

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 3 of 8
doaiena
in reply to: marko_ribar

Thank you for the answer. I had a fear you might say that.
Message 4 of 8
marko_ribar
in reply to: doaiena


@doaiena wrote:
Thank you for the answer. I had a fear you might say that.

doaiena, I've have to say that you don't need to do this tasks using MAX, you can fortunately do it all inside ACAD - only requirement is that you should have ACAD of newer generation A2012+... Analyze archive with DWG inside it and you should understand how could you also approach to this modelling tasks - part I've already explained - you should use BLOCK(s) with non-uniformly scaled factors...

 

HTH, at least it was beneficial discovery for me...

Regards, M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 5 of 8
doaiena
in reply to: marko_ribar

Thanks for the idea. It slipped my mind that you can explode a non-uniformly scaled block containing a mesh item. I will try it out and see if it fits my needs.
Message 6 of 8
marko_ribar
in reply to: doaiena

doaiena, here are some more explanations...

 

Firstly set "SMOOTHMESHCONVERT" to 3, so that when you use CONVTOSOLID, new 3DSOLID will have faceted surface - as much as similar to original Mesh from which it is to be converted...

All procedures can be done using just ACAD... Starting MESHOPTIONS for BEDIT 3DSOLID block is to be checked 1st option in 1st options, 2nd option in 2nd options use primitve presentation checked, and 3rd option in 3rd options is optional (you can smooth tessalation if you want, but not neccessary if your 3DSOLID is sharp primitive like BOX)... Then BSAVE block and do 2D scaling of it in Model Space... Now this block you can explode... Next is to convert exploded Mesh back to 3DSOLID - CONVTOSOLID command... Now you can use boolean operations on modified 3DSOLID (UNION, SUBTRACT, INTERSECT)... Then create new or redefine existing block by putting new 3DSOLID in it... BEDIT it and repeat MESHOPTIONS from first setting - if there are many edges now for second MESHOPTIONS use 3rd in 1st options (Triangles), next below adjust distance from 0.001 to larger number 0.1 or similar, angles should stay 40 degree, aspect 0.0 and max edge distance 0.0, still check 2nd option (use primitives) - but this now has no effect as your 3DSOLID was booleaned, and 3rd option is also optional... Mesh shouldn't be to complex - make it with as less edges as possible... Then BSAVE and do next 2D scaling =>EXPLODE=>CONVTOSOLID, and so on...

 

In archive there is this README.TXT and routines for operating with 3DFACEs entities...

 

Thanks for kudos... Yes, it's beneficial to all of us that are using ACAD for modelling...

 

Regards, M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 7 of 8
autodeskYDHKS
in reply to: marko_ribar

Hi there!

 

Sorry to Up this thread this long, but search engine bring me here, and it's related to what i'm look for.


I've just try to do you explanations, but this doesn't work for me.

I've done the MESHOPTIONS on bedit, that transform my solid3D on a mesh entity, at this step if i save the bloc and try to explode it, this one just disappears and leave me alone with an empty mesh entity! So then i try to explode mesh entity on the bloc, save it and explode, this work. But this group of triangle Face3D don't want to mesh again, impossible do make a solid back with this... I'm feeling very close...

Any help?

Message 8 of 8
marko_ribar
in reply to: autodeskYDHKS

I think you can achieve all this with correct geometry of 3DSOLIDS non uniformly scaled through CAD block... When you create block with 3DSOLIDS inside it, change X, Y, or Z scale factors and apply this routine... But you must have AutoCAD with newer releases A2012+ and plus you'll have to have Rhinoceros software installed... For me it works with Rhino 7...

 

 

 

 

 

(defun c:xyz-sc-blk-3ds-regs-surfs-to-3ds-regs-surfs-Rhino7 ( / *error* unique blksubents str+ cmd ucsf blk blkx obj cl ss i 3ds folder path f bln li lil el elx lst k lin )

  (vl-load-com)

  (defun *error* ( m )
    (if (= 8 (logand 8 (getvar (quote undoctl))))
      (if command-s
        (command-s "_.UNDO" "_E")
        (vl-cmdf "_.UNDO" "_E")
      )
    )
    (if ucsf
      (if command-s
        (command-s "_.UCS" "_P")
        (vl-cmdf "_.UCS" "_P")
      )
    )
    (if cl
      (setvar (quote clayer) cl)
    )
    (if cmd
      (setvar (quote cmdecho) cmd)
    )
    (if m
      (prompt m)
    )
    (princ)
  )

  (defun unique ( lst )
    (if lst
      (cons (car lst)
        (unique (vl-remove (car lst) (cdr lst)))
      )
    )
  )

  (defun blksubents ( bln / e el )
    (setq e (tblobjname "BLOCK" bln))
    (while (setq e (entnext e))
      (setq el (cons e el))
    )
    el
  )

  (defun str+ ( source / prefix rchar )
    (cond
      ( (= source "") "A")
      ( (= (setq prefix (substr source 1 (1- (strlen source)))
                  rchar (substr source (strlen source))
            )
            "Z"
        )
        (strcat (str+ prefix) "A")
      )
      ( (strcat prefix (chr (1+ (ascii rchar)))))
    )
  )

  (setq cmd (getvar (quote cmdecho)))
  (setvar (quote cmdecho) 0)
  (setq cl (getvar (quote clayer)))
  (if (= 8 (logand 8 (getvar (quote undoctl))))
    (if command-s
      (command-s "_.UNDO" "_E")
      (vl-cmdf "_.UNDO" "_E")
    )
  )
  (if command-s
    (command-s "_.UNDO" "_G")
    (vl-cmdf "_.UNDO" "_G")
  )
  (if (= 0 (getvar (quote worlducs)))
    (progn
      (if command-s
        (command-s "_.UCS" "_W")
        (vl-cmdf "_.UCS" "_W")
      )
      (setq ucsf t)
    )
  )
  (while
    (or
      (not (setq blk (car (entsel "\nPick non uniformly scaled block with 3DSOLID, REGION or SURFACE entities to convert to unblocked 3DSOLID, REGION or SURFACE entities..."))))
      (if blk
        (or
          (/= (cdr (assoc 0 (setq blkx (entget blk)))) "INSERT")
          (= (assoc 66 blkx) (cons 66 1))
          (not (snvalid (setq bln (cdr (assoc 2 blkx)))))
          (= (vla-get-isxref (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) bln)) :vlax-true)
          (not (vl-every (function (lambda ( x ) (wcmatch (cdr (assoc 0 (entget x))) "3DSOLID,REGION,*SURFACE*"))) (blksubents bln)))
        )
      )
    )
    (prompt "\nMissed or picked wrong entity type, or picked block with attributes, or picked block has not valid name, or picked INSERT not block but XREF, or picked block not with only 3DSOLID, REGION or SURFACE entities...")
    (textscr)
  )
  (if command-s
    (command-s "_.BEDIT" bln)
    (vl-cmdf "_.BEDIT" bln)
  )
  (setq ss (ssget "_A" (list (cons 0 "3DSOLID"))))
  (repeat (setq i (sslength ss))
    (setq 3ds (ssname ss (setq i (1- i))))
    (setvar (quote clayer) (cdr (assoc 8 (entget 3ds))))
    (vl-cmdf "_.SOLIDEDIT" "_B" "_P" 3ds)
    (while (< 0 (getvar 'cmdactive))
      (vl-cmdf "")
    )
  )
  (setq ss (ssget "_A" (list (cons 0 "3DSOLID"))))
  (repeat (setq i (sslength ss))
    (if command-s
      (command-s "_.UNDO" "_M")
      (vl-cmdf "_.UNDO" "_M")
    )
    (setq 3ds (ssname ss (setq i (1- i))))
    (setq vol (vla-get-volume (vlax-ename->vla-object 3ds)))
    (setq el (entlast))
    (vl-cmdf "_.CONVTONURBS" 3ds "")
    (while (setq el (entnext el))
      (setq nurbsl (cons el nurbsl))
    )
    (foreach surf nurbsl
      (setq el (entlast))
      (if command-s
        (command-s "_.XEDGES" surf "")
        (vl-cmdf "_.XEDGES" surf "")
      )
      (while (setq el (entnext el))
        (setq ell (cons el ell))
      )
      (if ell
        (setq elll (append ell elll))
      )
      (setq surfelllst (cons (list surf ell) surfelllst) ell nil)
    )
    (while (setq g (car surfelllst))
      (setq surfelllst (cdr surfelllst))
      (setq gg (cons g gg))
      (while (if (null g) (setq g (car gaa)) g)
        (if (cadr g)
          (foreach ell (cadr g)
            (setq ga
              (vl-remove-if-not
                (function (lambda ( x )
                  (and
                    (cadr x)
                    (vl-some
                      (function (lambda ( y )
                        (if
                          (and
                            (or
                              (equal (vlax-curve-getstartpoint ell) (vlax-curve-getstartpoint y) 1e-6)
                              (equal (vlax-curve-getstartpoint ell) (vlax-curve-getendpoint y) 1e-6)
                            )
                            (or
                              (equal (vlax-curve-getendpoint ell) (vlax-curve-getstartpoint y) 1e-6)
                              (equal (vlax-curve-getendpoint ell) (vlax-curve-getendpoint y) 1e-6)
                            )
                          )
                          x
                        )
                      ))
                      (cadr x)
                    )
                  )
                ))
                surfelllst
              )
            )
            (setq gg (append gg ga))
            (setq gaa (append gaa ga))
          )
        )
        (setq gl (cons g gl))
        (if gaa
          (setq gaa (unique (vl-remove-if (function (lambda ( x ) (vl-position x gl))) gaa)))
        )
        (setq g nil)
      )
      (setq gg (unique (mapcar (function car) gg)))
      (setq gagg (cons gg gagg))
      (setq surfelllst (vl-remove-if (function (lambda ( x ) (vl-position (car x) gg))) surfelllst))
      (setq gg nil gl nil)
    )
    (foreach e elll
      (if (not (vlax-erased-p e))
        (entdel e)
      )
    )
    (setq el (entlast))
    (foreach g gagg
      (setq s (ssadd))
      (foreach surf g
        (ssadd surf s)
      )
      (if (> (sslength s) 0)
        (progn
          (setvar (quote clayer) (cdr (assoc 8 (entget (ssname s 0)))))
          (if command-s
            (command-s "_.UNION" s "")
            (vl-cmdf "_.UNION" s "")
          )
          (if (null (ssget "_P"))
            (if command-s
              (command-s "_.SURFSCULPT" "_L" "")
              (vl-cmdf "_.SURFSCULPT" "_L" "")
            )
            (if command-s
              (command-s "_.SURFSCULPT" "_P" "")
              (vl-cmdf "_.SURFSCULPT" "_P" "")
            )
          )
        )
      )
    )
    (while (setq el (entnext el))
      (setq 3dsl (cons el 3dsl))
    )
    (if (not (vl-every (function (lambda ( x ) (= (cdr (assoc 0 (entget x))) "3DSOLID"))) 3dsl))
      (if command-s
        (command-s "_.UNDO" "_B")
        (vl-cmdf "_.UNDO" "_B")
      )
      (progn
        (setq 3dsl (vl-sort 3dsl (function (lambda ( a b ) (> (vla-get-volume (vlax-ename->vla-object a)) (vla-get-volume (vlax-ename->vla-object b)))))))
        (if (not (equal vol (vla-get-volume (vlax-ename->vla-object (setq 3ds (car 3dsl)))) 1e-6))
          (foreach sol (cdr 3dsl)
            (if command-s
              (command-s "_.SUBTRACT" 3ds "" sol "")
              (vl-cmdf "_.SUBTRACT" 3ds "" sol "")
            )
          )
        )
      )
    )
    (setq nurbsl nil ell nil elll nil surfelllst nil g nil gg nil ga nil gaa nil gl nil gagg nil vol nil 3ds nil el nil 3dsl nil)
  )
  (setvar (quote clayer) cl)
  (if command-s
    (command-s "_.BSAVE")
    (vl-cmdf "_.BSAVE")
  )
  (if command-s
    (command-s "_.BCLOSE")
    (vl-cmdf "_.BCLOSE")
  )
  (while (findfile (setq path (strcat "c:\\" (if (null folder) (setq folder (str+ "")) (setq folder (str+ folder)))))))
  (acet-file-mkdir path)
  (setq f (open (strcat path "\\CAD-block-Rhino-CAD-exploded.rvb") "w"))
  (write-line "Option Explicit" f)
  (write-line "Call Main()" f)
  (write-line "Sub Main()" f)
  (write-line (strcat "Rhino.Command \"-_Import" " " path "\\" "x.dwg" " " "_EnterEnd\"") f)
  (write-line "Rhino.Command \"_SelAll\"" f)
  (write-line "Rhino.Command \"_ExplodeBlock\"" f)
  (write-line (strcat "Rhino.Command \"-_Export" " " path "\\" "xxx.sat" " " "_Enter" " " "_EnterEnd\"") f)
  (write-line "Rhino.DocumentModified(False)" f)
  (write-line "Rhino.Exit()" f)
  (write-line "End Sub" f)
  (close f)
  (if command-s
    (command-s "_.UCS" "_W")
    (vl-cmdf "_.UCS" "_W")
  )
  (setq el (tblobjname "BLOCK" bln))
  (while (setq el (entnext el))
    (setq elx (entget el))
    (setq lst
      (cons
        (list
          (cdr (assoc 8 elx))
          (if (assoc 62 elx)
            (assoc 62 elx)
          )
          (if (assoc 420 elx)
            (assoc 420 elx)
          )
          (if (assoc 430 elx)
            (assoc 430 elx)
          )
        )
        lst
      )
    )
  )
  (if command-s
    (command-s "_.-WBLOCK" (strcat path "\\" bln ".dwg") "" "_non" (list 0.0 0.0 0.0) blk "")
    (vl-cmdf "_.-WBLOCK" (strcat path "\\" bln ".dwg") "" "_non" (list 0.0 0.0 0.0) blk "")
  )
  (setq lin (entmakex (list (cons 0 "LINE") (list 10 0.0 0.0 0.0) (list 11 0.0 0.0 0.0))))
  (setq el lin)
  (setq f (open (strcat path "\\" "CAD-block-Rhino-CAD-exploded.rvb") "r"))
  (while (setq li (read-line f))
    (setq lil (cons li lil))
  )
  (setq lil (reverse lil))
  (close f)
  (setq f (open (strcat path "\\" "CAD-block-Rhino-CAD-exploded.rvb") "w"))
  (foreach li lil
    (if (= li (strcat "Rhino.Command \"-_Import" " " path "\\" "x.dwg" " " "_EnterEnd\""))
      (write-line (strcat "Rhino.Command \"-_Import" " " path "\\" bln ".dwg" " " "_EnterEnd\"") f)
      (write-line li f)
    )
  )
  (close f)
  (startapp (strcat "C:\\Program Files\\Rhino 7\\System\\Rhino.exe " "\"" path "\\" "CAD-block-Rhino-CAD-exploded.rvb" "\""))
  (alert "NOW WAIT FOR RHINO TO DO OPERATIONS AND AUTOMATICALLY CLOSE...\nONLY THEN PRESS OK TO CLOSE THIS ALERT MESSAGE...")
  (setq f (open (strcat path "\\" "CAD-block-Rhino-CAD-exploded.rvb") "w"))
  (foreach li lil
    (write-line li f)
  )
  (close f)
  (if command-s
    (command-s "_.ACISIN" (strcat path "\\" "xxx.sat"))
    (vl-cmdf "_.ACISIN" (strcat path "\\" "xxx.sat"))
  )
  (setq k -1)
  (while (setq el (entnext el))
    (setq elx (entget el))
    (setq elx (subst (cons 8 (car (nth (setq k (1+ k)) lst))) (assoc 8 elx) elx))
    (setq elx (if (cadr (nth k lst)) (append elx (list (cadr (nth k lst)))) elx))
    (setq elx (if (caddr (nth k lst)) (append elx (list (caddr (nth k lst)))) elx))
    (setq elx (if (cadddr (nth k lst)) (append elx (list (cadddr (nth k lst)))) elx))
    (entupd (cdr (assoc -1 (entmod elx))))
  )
  (entdel lin)
  (if (tblsearch "BLOCK" bln)
    (if (not (ssget "_X" (list (cons 0 "INSERT") (cons 2 bln))))
      (if command-s
        (command-s "_.PURGE" "_B" bln "_N")
        (vl-cmdf "_.PURGE" "_B" bln "_N")
      )
    )
  )
  (if (findfile (strcat path "\\" bln ".dwg"))
    (vl-file-delete (strcat path "\\" bln ".dwg"))
  )
  (if (findfile (strcat path "\\" "xxx.sat"))
    (vl-file-delete (strcat path "\\" "xxx.sat"))
  )
  (if (findfile (strcat path "\\" "CAD-block-Rhino-CAD-exploded.rvb"))
    (vl-file-delete (strcat path "\\" "CAD-block-Rhino-CAD-exploded.rvb"))
  )
  (if command-s
    (command-s "_.SHELL" (strcat "rd /q /s " path))
    (vl-cmdf "_.SHELL" (strcat "rd /q /s " path))
  )
  ;(acet-file-rmdir path)
  (*error* nil)
)

 

 

 

 

 

HTH., Geometry - smoothing of curved surfaces from which 3DSOLIDS are made should be preserved... So no MESHing at all...

Regards, M.R.

 

Here are *.lsp and *.rvb that work combined for the same similar task operational and from both BricsCAD and AutoCAD :

 

 

(defun c:xyz-sc-block-3Dsolids-by-using-Rhino7 ( / *error* cmd ucsf bl bln fn li lil el elx lst k lin )

  (defun *error* ( m bln )
    (if (findfile (strcat (getvar (quote tempprefix)) bln ".dwg"))
      (vl-file-delete (strcat (getvar (quote tempprefix)) bln ".dwg"))
    )
    (if (findfile (strcat (getvar (quote tempprefix)) "xxx.sat"))
      (vl-file-delete (strcat (getvar (quote tempprefix)) "xxx.sat"))
    )
    (if (findfile "C:\\Users\\Korisnik\\Documents\\xxx.sat")
      (vl-file-delete "C:\\Users\\Korisnik\\Documents\\xxx.sat")
    )
    (if (tblsearch "BLOCK" bln)
      (if (not (ssget "_X" (list (cons 0 "INSERT") (cons 2 bln))))
        (if command-s
          (command-s "_.purge" "_b" bln "_n")
          (vl-cmdf "_.purge" "_b" bln "_n")
        )
      )
    )
    (if ucsf
      (if command-s
        (command-s "_.ucs" "_p")
        (vl-cmdf "_.ucs" "_p")
      )
    )
    (if cmd
      (setvar (quote cmdecho) cmd)
    )
    (if m
      (prompt m)
    )
    (princ)
  )

  (setq cmd (getvar (quote cmdecho)))
  (setvar (quote cmdecho) 0)
  (if (findfile (strcat (getvar (quote tempprefix)) "CAD-block-rhino-CAD-exploded.rvb"))
    (vl-file-delete (strcat (getvar (quote tempprefix)) "CAD-block-rhino-CAD-exploded.rvb"))
  )
  (vl-file-copy "C:\\Users\\Korisnik\\Documents\\CAD-block-rhino-CAD-exploded.rvb" (strcat (getvar (quote tempprefix)) "CAD-block-rhino-CAD-exploded.rvb"))
  (alert "To prepare MODEL to correct Rhino DWG import, apply (c:3dsolids-nurbs-union-3dsolids), (c:3dsolids-nurbs-union-3dsolids-new)-faster or (c:3dsolids-nurbs-union-rhino-3dsolids), (c:3dsolids-nurbs-union-rhino-3dsolids-new)-if you have more time- to 3DSOLID or SURFACE entities before creation of non-uniformly scaled block on which you want to apply this intervention...")
  (alert "Place \"CAD-block-rhino-CAD-exploded.rvb\" file in \"C:\\Users\\Korisnik\\Documents\\\" path - when all OK restart routine...")
  (if (= 0 (getvar (quote worlducs)))
    (progn
      (if command-s
        (command-s "_.ucs" "_w")
        (vl-cmdf "_.ucs" "_w")
      )
      (setq ucsf t)
    )
  )
  (while
    (or
      (not (setq bl (car (entsel "\nPick non uniformly scaled block with 3D solids/surfaces..."))))
      (if bl
        (/= (cdr (assoc 0 (entget bl))) "INSERT")
      )
    )
    (prompt "\nMissed or picked wrong entity type...")
  )
  (setq bln (cdr (assoc 2 (entget bl))))
  (setq el (tblobjname "BLOCK" bln))
  (while (setq el (entnext el))
    (setq elx (entget el))
    (setq lst
      (cons
        (list
          (cdr (assoc 8 elx))
          (if (assoc 62 elx)
            (assoc 62 elx)
          )
          (if (assoc 420 elx)
            (assoc 420 elx)
          )
          (if (assoc 430 elx)
            (assoc 430 elx)
          )
        )
        lst
      )
    )
  )
  ;(vl-cmdf "_.-wblock" (strcat "C:\\Users\\Korisnik\\Documents\\" bln ".dwg") "" "_non" '(0.0 0.0 0.0) bl "")
  (if command-s
    (command-s "_.-wblock" (strcat (getvar (quote tempprefix)) bln ".dwg") "" "_non" (list 0.0 0.0 0.0) bl "")
    (vl-cmdf "_.-wblock" (strcat (getvar (quote tempprefix)) bln ".dwg") "" "_non" (list 0.0 0.0 0.0) bl "")
  )
  (while (not (findfile (strcat (getvar (quote tempprefix)) bln ".dwg"))))
  (setq lin (entmakex (list (cons 0 "LINE") (list 10 0.0 0.0 0.0) (list 11 0.0 0.0 0.0))))
  (setq el lin)
  (setq fn (open "C:\\Users\\Korisnik\\Documents\\CAD-block-rhino-CAD-exploded.rvb" "r"))
  (while (setq li (read-line fn))
    (setq lil (cons li lil))
  )
  (setq lil (reverse lil))
  (close fn)
  (setq fn (open "C:\\Users\\Korisnik\\Documents\\CAD-block-rhino-CAD-exploded.rvb" "w"))
  (foreach li lil
    (if (= li "\tRhino.Command \"-_Import C:\\Users\\Korisnik\\Documents\\x.dwg _EnterEnd\"")
      (write-line (strcat "\tRhino.Command \"-_Import " (getvar (quote tempprefix)) bln ".dwg _EnterEnd\"") fn)
      (write-line li fn)
    )
  )
  (close fn)
  (startapp "C:\\Program Files\\Rhino 7\\System\\Rhino.exe /runscript=\"_-LoadScript C:\\Users\\Korisnik\\Documents\\CAD-block-rhino-CAD-exploded.rvb\"")
  ;(startapp "EXPLORER" "C:\\Users\\Korisnik\\Documents\\CAD-block-rhino-CAD-exploded.rvb")
  (while (not (findfile "C:\\Users\\Korisnik\\Documents\\xxx.sat")))
  (alert "NOW WAIT FOR RHINO TO DO OPERATIONS AND AUTOMATICALLY CLOSE...\nONLY THEN PRESS OK TO CLOSE THIS ALERT MESSAGE...")
  (setq fn (open "C:\\Users\\Korisnik\\Documents\\CAD-block-rhino-CAD-exploded.rvb" "w"))
  (foreach li lil
    (write-line li fn)
  )
  (close fn)
  (if (findfile "C:\\Users\\Korisnik\\Documents\\xxx.sat")
    (progn
      (if (findfile (strcat (getvar (quote tempprefix)) "xxx.sat"))
        (vl-file-delete (strcat (getvar (quote tempprefix)) "xxx.sat"))
      )
      (vl-file-copy "C:\\Users\\Korisnik\\Documents\\xxx.sat" (strcat (getvar (quote tempprefix)) "xxx.sat"))
    )
  )
  (if command-s
    (command-s "_.acisin" (strcat (getvar (quote tempprefix)) "xxx.sat"))
    (vl-cmdf "_.acisin" (strcat (getvar (quote tempprefix)) "xxx.sat"))
  )
  (setq k -1)
  (while (setq el (entnext el))
    (setq elx (entget el))
    (setq elx (subst (cons 8 (car (nth (setq k (1+ k)) lst))) (assoc 8 elx) elx))
    (setq elx (if (cadr (nth k lst)) (append elx (list (cadr (nth k lst)))) elx))
    (setq elx (if (caddr (nth k lst)) (append elx (list (caddr (nth k lst)))) elx))
    (setq elx (if (cadddr (nth k lst)) (append elx (list (cadddr (nth k lst)))) elx))
    (entupd (cdr (assoc -1 (entmod elx))))
  )
  (entdel lin)
  (*error* nil bln)
)

 

 

Here is *.rvb - it's called : CAD-block-rhino-CAD-exploded.rvb   and it should be placed in c:\Users\Korisnik\Documents\   folder...

(change "Korisnik" to adequate according to your formed personal folder under Windows OS...) and replace all occurrences in previous code *.lsp...

 

 

Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version Sunday, January 27, 2019 9:21:07 PM

Call Main()
Sub Main()
	Rhino.Command "-_Import C:\Users\Korisnik\Documents\x.dwg _EnterEnd"
	Rhino.Command "_SelAll"
	Rhino.Command "_ExplodeBlock"
	Rhino.Command "-_Export C:\Users\Korisnik\Documents\xxx.sat _Enter _EnterEnd"
	Rhino.DocumentModified(False)
	Rhino.Exit()
End Sub

 

 

That's all - with those 2 files - non uniform 3DSOLID scale should be possible to manage quickly with not special Import/Explode/Export procedures within Rhino 7...

HTH. M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)

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

Post to forums  

Autodesk Design & Make Report

”Boost