+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Super Member halam's Avatar
    Using
    AutoCAD 2017
    Join Date
    Jul 2015
    Posts
    694

    Default Cilinder effect 2d (error in 2018)

    Registered forum members do not see this ad.

    This routine give a nice touch to round stuff in 2D.
    Problem is i can't get it to work in 2018, it quits after findfile "acad.exe"
    Any idea what this could be?


    Also: i need to get it to work in a rotated UCS, not WCS.


    Code:
    
    ; cilinder effect
    (defun c:cef (/ p1 p2 obj ll ur ltp sc ent an OldOsmode DIR FILE VARLST VARLT X)
      (vl-arx-import 'BPOLY)  
      (or (findfile "cyl1.pat")
          (progn
     (setq dir  (vl-filename-directory (findfile "acad.exe"))
           file (open (strcat dir "\\cyl1.pat")
        "w"
         )
     )
     (mapcar (function(lambda (x)
         (princ x file)
         (princ "\n" file)
       ))
      (list
        "*cyl1,Cylinder effect"  "0, 0,0.01, 0,1"
        "0, 0,0.02, 0,1"    "0, 0,0.04, 0,1"
        "0, 0,0.08, 0,1"    "0, 0,0.16, 0,1"
        "0, 0,0.30, 0,1"    "0, 0,0.50, 0,1"
        "0, 0,0.70, 0,1"    "0, 0,0.84, 0,1"
        "0, 0,0.92, 0,1"    "0, 0,0.96, 0,1"
        "0, 0,0.98, 0,1"    "0, 0,0.99, 0,1"
       )
     )
     (close file)
          )
      )
      (foreach var
            '(("cmdecho" . 0)
       ("osmode" . nil)
       ("cecolor" . "253")
       ("snapbase" . nil)
       ("hporiginmode" . nil)
       ("hporigin" . nil)
      )
        (setq varlst (cons (cons (car var) (getvar (car var)))
             Varlst
       )
        )
        (if (cdr var)
          (setvar (car var) (cdr var))
        )
      )
      (or sc (setq sc 1.00))
      (or an (setq an (/ pi 2)))
      (setq OldOsmode (getvar "osmode"))
      (if (/= (logand oldosmode 16384) 16384)
        (setvar "osmode" (+ oldosmode 16384))
      )
      (setq ent (bpoly (getpoint "\n Specify internal point:"))
      )
      (if ent
        (progn
          (setvar "osmode" oldosmode)
          (setq
     p1 (getpoint (strcat "\n Specify first point for distance: <"
            (rtos sc 2 2)
            ">"
           )
        )
          )
          (if p1
     (setq p2 (getpoint p1 "\n Specify second point: ")
     )
     (progn
       (vla-getboundingbox
         (vlax-ename->vla-object ent)
         'll
         'ur
       )
       (setq
         ltp (mapcar 'vlax-safearray->list (list ll ur))
         p1 (car ltp)
         p2 (list (car (cadr ltp)) (cadr (car ltp)))
       )
     )
          )
         ; (command "line" (trans p1 0 1) (trans
         ; p2 0
         ; 1))
          (setq sc (distance (trans p1 0 1) (trans p2 0 1))
         an (+ (angle p1 p2) (/ pi 2))
          )
          (if (>= (atof (substr (getvar "acadver") 1 4)) 16.2)
     (progn
       (setvar "hporiginmode" 0)
       (setvar "hporigin" (reverse (cdr (reverse p1))))
     )
     (setvar "snapbase" (reverse (cdr (reverse p1))))
          )
          (command "-bhatch"
            "p"
            "CYL1"
            sc
            (radian->degrees an)
            "s"
            ent
            ""
            ""
          )
          (entdel ent)
        )
      )
      (if varlst
        (mapcar '(lambda (x)
            (setvar (car x) (cdr x))
          )
         varlt
        )
      )
      (princ)
    )
    (DEFUN Radian->Degrees (nbrOfRadians /)
      (* 180.0 (/ nbrOfRadians PI))
    ) ;_ end of defun
    Attached Images
    Last edited by halam; 8th Mar 2018 at 11:46 pm.
    Modelling is done with two hands, 2d & 3d. Let it work together..
    https://twitter.com/halammerts

  2. #2
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    673

    Default

    Regarding issue #1:
    Windows restricts access to certain critical folders and you probably do not have permission to write to the folder where acad.exe is located. Try changing "acad.exe" to "acad.pat".
    BricsCAD 18

  3. #3
    Super Member halam's Avatar
    Using
    AutoCAD 2017
    Join Date
    Jul 2015
    Posts
    694

    Default

    Thanks Roy, that did the trick indeed.
    The angle of the created hatch (& units set in grad) results in funny cilinders
    But that's all cosmetics ;-) glad you made it work again!
    Modelling is done with two hands, 2d & 3d. Let it work together..
    https://twitter.com/halammerts

  4. #4
    Super Member halam's Avatar
    Using
    AutoCAD 2017
    Join Date
    Jul 2015
    Posts
    694

    Default

    Registered forum members do not see this ad.

    Recieved this link which describes it perfectly.https://screencast-o-matic.com/watch/cFeobrDZOy
    Modelling is done with two hands, 2d & 3d. Let it work together..
    https://twitter.com/halammerts

Similar Threads

  1. AutoCAD 2018 with Fabrication MEP 2018 plot bug
    By Cerryl in forum AutoCAD Bugs, Error Messages & Quirks
    Replies: 2
    Last Post: 28th Dec 2017, 07:53 pm
  2. AutoCAD 2018.1 and AutoCAD LT 2018.1 Update Now Available
    By Between the Lines in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 28th Jul 2017, 01:10 am
  3. Disable the Glowing Line Highlighting Effect inside AutoCAD 2018
    By The CAD Geek Blog in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 5th Jun 2017, 03:20 pm
  4. Force effect
    By MUTTLEY in forum Autodesk Inventor
    Replies: 0
    Last Post: 21st Nov 2012, 04:29 pm
  5. I need to color a surface of a cilinder
    By Anya_N in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 16th Jan 2007, 05:16 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts