Jump to content

Recommended Posts

Posted

Use the same apply that I did for changing the linweight .

 

eg.

 

(if (and (eq (vla-get-objectname (car x)) "AcDbCircle")
                   (eq (vla-get-linetype (car x)) "Continuous")
                   )
            (vla-put-lineweight  [color="red"](car x)[/color] acLnWt035)
            )

 

One more thing , as I have reminded you earlier that there was a simple typo in my last reply and anyway I corrected here in this post as highlighted in RED above ;)

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • cadfan

    14

  • Tharwat

    9

  • BIGAL

    2

  • David Bethel

    1

Top Posters In This Topic

Posted Images

Posted
Use the same apply that I did for changing the linweight .

 

eg.

 

(if (and (eq (vla-get-objectname (car x)) "AcDbCircle")
                   (eq (vla-get-linetype (car x)) "Continuous")
                   )
            (vla-put-lineweight  [color="red"](car x)[/color] acLnWt035)
            )

 

One more thing , as I have reminded you earlier that there was a simple typo in my last reply and anyway I corrected here in this post as highlighted in RED above ;)

 

Thank you .Mr.Tharwat

 

Ability is limited, can't understand . can you help me this time ?

Posted

The following codes to create objects as implemented into your codes .

 

(setq cir (vlax-invoke space 'addcircle pcen r)
     arc (vlax-invoke space 'addarc pcen mr 4.71239 3.14159)
     ln1 (vlax-invoke space 'addline p1 p3)
     ln2 (vlax-invoke space 'addline p2 p4)
     )

 

Where variables :

cir = circle

arc = arc

ln1 = first line

ln2 = second line

 

Then use the following method to move circle to a specific layer that should be existed in your drawing ;

(vla-put-layer cir "screw")

 

And the same should be used to any other objects .

Posted (edited)
The following codes to create objects as implemented into your codes .

 

(setq cir (vlax-invoke space 'addcircle pcen r)
     arc (vlax-invoke space 'addarc pcen mr 4.71239 3.14159)
     ln1 (vlax-invoke space 'addline p1 p3)
     ln2 (vlax-invoke space 'addline p2 p4)
     )

 

Where variables :

cir = circle

arc = arc

ln1 = first line

ln2 = second line

 

Then use the following method to move circle to a specific layer that should be existed in your drawing ;

(vla-put-layer cir "screw")

 

And the same should be used to any other objects .

 

Thank , Mr.Tharwat.

 

   (setq cir (vlax-invoke space 'addcircle pcen r)
         arc (vlax-invoke space 'addarc pcen mr 4.71239 3.14159)
         ln1 (vlax-invoke space 'addline p1 p3)
         ln2 (vlax-invoke space 'addline p2 p4)
   )
[color="red"]    (vla-put-layer ln1 "centreline")
   (vla-put-layer ln2 "centreline")[/color]
  
   (mapcar '(lambda (x)
              (vlax-put (car x) 'layer "screw")
              (vlax-put (car x) 'color (cadr x))
              (vlax-put (car x) "linetype" (caddr x))
              (vlax-put (car x) "linetypescale" xk)
            )
           (list (list cir 33 cel)
                 (list arc 3 cel)
                 (list ln1 1 "center")
                 (list ln2 1 "center")
           )
   )

Edited by cadfan
Posted

Another...

 

(defun c:tt (...)
 (defun _make (...)
   ...
   (setq cir (vlax-invoke space 'addcircle pcen r)
         arc (vlax-invoke space 'addarc pcen mr 4.71239 3.14159)
         ln1 (vlax-invoke space 'addline p1 p3)
         ln2 (vlax-invoke space 'addline p2 p4)
   )
   (mapcar '(lambda (x)
              (vlax-put (car x) 'layer [color=red](cadr x)[/color])
              (vlax-put (car x) 'color [color=red](caddr x)[/color])
              (vlax-put (car x) "linetype" [color=red](cadddr x)[/color])
              (vlax-put (car x) "linetypescale" xk)
              (if (and (eq (vla-get-objectname (car x)) "AcDbCircle")
                       (eq (vla-get-linetype (car x)) "Continuous")
                  )
                  (vla-put-lineweight (car x) acLnWt035)
              )
            )
           (list [color=red](list cir "screw" 33 cel)
                 (list arc "screw" 3 cel)
                 (list ln1 "centreline" 1 "center")
                 (list ln2 "centreline" 1 "center")[/color]
           )
   )
   (if        (member "isText" slst)
     (progn
       (setq txt (vlax-invoke space 'AddText str pcen (* mr 0.4)))
       (vla-put-alignment txt acAlignmentTopCenter)
       (vla-put-textalignmentpoint
         txt
         (vlax-3d-point (polar pcen (- _pi2) (* mr 0.17)))
       )
       [color=red](vla-put-layer txt "text") [/color]
     )
   )
   (if        (member "isBlock" slst)
     (vlax-invoke
       (fy:acspace)
       'insertblock
       pcen
       (vla-get-name space)
       1.
       1.
       1.
       0.
     )
   )
 )
...
 (if (and (= (xd::dcl:start id fn)
             1
          )
          (setq ss (ssget '((0 . "circle")
                            (-4 . "<or")
                            (40 . 2.5)
                            (40 . 3.3)
                            (40 . 4.2)
                            (40 . 5.0)
                            (40 . 6.
                            (40 . 8.5)
                            (40 . 10.5)
                            (40 . 12.0)
                            (40 . 14.0)
                            (40 . 15.5)
                            (40 . 17.5)
                            (-4 . "or>")
                           )
                   )
          )
     )
   (progn
     (if (not (tblsearch "style" "txt"))
       (command ".style"    "txt"         "txt.shx,gbcbig.shx"
                0.0             1.0         0.0             "n"
                "n"             "n"
               )
     )
     (if (not (tblsearch "ltype" "hidden"))
       (vla-load (fy:acltypes) "hidden" "acadiso.lin")
     )
     (if (not (tblsearch "ltype" "center"))
       (vla-load (fy:acltypes) "center" "acadiso.lin")
     )
     (if (not (tblsearch "layer" "screw"))
       (vla-add (fy:aclayers) "screw")
     )
     [color=red](if (not (tblsearch "layer" "centreline"))
       (vla-add (fy:aclayers) "centreline")
     )
     (if (not (tblsearch "layer" "text"))
       (vla-add (fy:aclayers) "text")
     )[/color]
     (mapcar '(lambda (x) (_make x)) (fy:cset->objs))
     (if (member "isErased" slst)
       (command ".erase" ss "")
     )
   )
 )
 (princ)
)

Posted (edited)
Another...

 

 

8) , Thank you ,marko. I will read carefully . TKS.

Edited by cadfan
Posted
Another...

 

Hi marko .

This modify is most beautiful . :thumbsup:

   (mapcar '(lambda (x)
              (vlax-put (car x) 'layer [color="red"](cadr x)[/color])
              (vlax-put (car x) 'color [color="red"](caddr x)[/color])
              (vlax-put (car x) "linetype" [color="red"](cadddr x)[/color])
              (vlax-put (car x) "linetypescale" xk)
              (if (and (eq (vla-get-objectname (car x)) "AcDbCircle")
                       (eq (vla-get-linetype (car x)) "Continuous")
                  )
                  (vla-put-lineweight (car x) acLnWt035)
              )
            )
           (list [color="red"](list cir "screw" 33 cel)[/color]
                [color="red"] (list arc "screw" 3 cel)[/color]
                [color="red"] (list ln1 "centreline" 1 "center")[/color]
                [color="red"] (list ln2 "centreline" 1 "center")[/color]
           )
   )

 

Now , All problems have been solved ! Many thanks! Tharwat, Marko.

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