Jump to content

Cilinder effect 2d (error in 2018)


halam

Recommended Posts

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.

 

 



; 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 "[url="file://cyl1.pat/"]\\cyl1.pat[/url]")
   "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

Knipsel.jpg

cilindereffect.jpg

Edited by halam
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

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