Jump to content

Recommended Posts

Posted

Hi there guys

 

I'm looking to map layer sets from one set of drawings to another set via VL (inside a script).

 

The problem for me is I can't find the DXF code 370 ( lineweight ename value ) when using tblnext to get the "LAYER" symbol table parameters. (have changed lineweight with layer manager to be sure)

Is there afurther step I need to include past the tblnext cmd?

 

Alternately I need the vla commands that interigate the symbol table for lineweight.

(I can't even get the vla-get-freeze to work tho so the code for the collection would be helpful too.)

 

would anyone have that elusive idea / bit of code ?

 

Thanks in advance

 

Matt

  • Replies 35
  • Created
  • Last Reply

Top Posters In This Topic

  • pBe

    13

  • Lee Mac

    7

  • bgerico

    6

  • MSasu

    4

Top Posters In This Topic

Posted

Try using TBLOBJNAME instead:

 

(entget (tblobjname "LAYER" "0"))

 

Regards,

Mircea

Posted (edited)

Thanks Mircea

that worked perfectly :)

 

I also worked out/borrowed the collection and lineweight using

 

(vlax-for layers 
(vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object)))
   (setq lay_linewt (vla-get-lineweight layers)) ; where default linewt = -3
) ; end for

 

but need to put in more code to get the result to mean anything

Edited by SLW210
  • 2 weeks later...
Posted

Hello everyone,

 

I am new to this forum. I had the same problem as Matt, I am looking for the DXF code 370 (lineweight ename value) that is assigned to Text or Mtext. I am trying to write a lisp routine that selects all text and mtext and determines if the text lineweight is less than .012". if it is then change it to .012". Here at my company we are having a problem seeing the fonts when plotting if they are less than .012", which is our standard. We found many drawings that contained .000" or .010".

Does anyone have code that would do this sort of routine. Any help would be great.

 

Thanks, Rick

Posted

For both TEXT and MTEXT entities the lineweight is stored on DXF code 370, which is listed when get the associated list by ENTGET. When there is no 370 code, then the lineweight is set to ByLayer.

 

Regards,

Mircea

Posted (edited)

 
(defun c:MTLwt  (/ ss e i)
     (vl-load-com)
     (if (setq ss (ssget "_X" '((0 . "*TEXT"))))
           (repeat (setq i (sslength ss))
                 (if (< (vla-get-lineweight
                              (setq e (vlax-ename->vla-object
                                      (ssname  ss (setq i    (1- i))))))
                        30)
                       (vla-put-lineweight e 30))
                 )
           )
     (princ)
     )

 

Vanilla

(defun c:MTLwt  (/ ss e a)
     (if (setq ss (ssget "_X" '((0 . "*TEXT"))))
           (repeat (setq i (sslength ss))
                 (setq e (entget (ssname ss (setq i (1- i)))))
                 (cond
                       ((not (setq a (assoc 370 e)))
                        (entmod (append e '((370 . 30)))))
                       ((< (cdr a) 30)
                        (entmod (subst '(370 . 30) a e))))))(princ)
     )

 

You can however modiy the layer where the text/mtext is currently assigned and change the linewight to 30 and change all text/mtext LW property to bylayer.. (just a thought)

Edited by pBe
Edit formatting....
Posted

pBe , I couldn't finish my code before you modified your last post and added Vanilla one , so I should save my code into my toolbox. :lol:

 

I guess the OP needs the lineweight to be 0.13 and neither 0.12 or 0.30 .

 

Thanks

 

I am trying to write a lisp routine that selects all text and mtext and determines if the text lineweight is less than .012". if it is then change it to .012".

Posted

One comment, just don’t forget that the lineweight setting is obsolete if the font is TTF.

 

 

Regards,

Mircea

Posted
pBe , I couldn't finish my code before you modified your last post and added Vanilla one , so I should save my code into my toolbox. :lol:

 

I guess the OP needs the lineweight to be 0.13 and neither 0.12 or 0.30 .

 

Thanks

 

0.012" [inches] ---> 30mm

Besides, i dont think you can assign floating numbers to DXF 370.

Posted
0.012" [inches] ---> 30mm

 

I am sorry , I did not notice the inch mark :oops:

 

Besides, i dont think you can assign floating numbers to DXF 370.

 

Did not get your idea .:o

 

Thanks

Posted
One comment, just don’t forget that the lineweight setting is obsolete if the font is TTF.

Regards,

Mircea

 

I never knew that Mircea. Good point.

Also the need to check for valid values for LW, otherwise it wont do a thing. (i.e. 14 32 invalid values) ;)

 

Cheers

Posted

A minor optimisation:

 

(defun c:txtwgt ( / a e i s )
   (if (setq s (ssget "_X" '((0 . "*TEXT") (-4 . "<NOT") (-4 . ">=") (370 . 30) (-4 . "NOT>"))))
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i)))))
           (if (setq a (assoc 370 e))
               (entmod (subst '(370 . 30) a e))
               (entmod (append e '((370 . 30))))
           )
       )
   )
   (princ)
)

Posted
I am sorry , I did not notice the inch mark :oops:

 

No worries tharwat :)

 

Did not get your idea .:o

Thanks

 

0.30 or 1.50 nor 1 12 28

Posted
Reference:

 

quote_icon.png Originally Posted by DXF Reference

...

330-369 String representing hex object IDs

370-379 16-bit integer value

380-389 16-bit integer value

...

 

 

http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-7a64.htm

 

Yes. that. ;)

 

Thank you for WiLeepedia

 

A minor optimisation:

......(setq s (ssget "_X" '((0 . "*TEXT") (-4 . "<NOT") (-4 . ">=") (370 . 30) (-4 . "NOT>")))).....

 

Better :thumbsup:

Posted

Thanks for the quick reply. Its nice to have this in both versions. The program worked great. This is exactly what we were looking for.

Thanks again.

 

 
(defun c:MTLwt  (/ ss e i)
     (vl-load-com)
     (if (setq ss (ssget "_X" '((0 . "*TEXT"))))
           (repeat (setq i (sslength ss))
                 (if (< (vla-get-lineweight
                              (setq e (vlax-ename->vla-object
                                      (ssname  ss (setq i    (1- i))))))
                        30)
                       (vla-put-lineweight e 30))
                 )
           )
     (princ)
     )

 

Vanilla

(defun c:MTLwt  (/ ss e a)
     (if (setq ss (ssget "_X" '((0 . "*TEXT"))))
           (repeat (setq i (sslength ss))
                 (setq e (entget (ssname ss (setq i (1- i)))))
                 (cond
                       ((not (setq a (assoc 370 e)))
                        (entmod (append e '((370 . 30)))))
                       ((< (cdr a) 30)
                        (entmod (subst '(370 . 30) a e))))))(princ)
     )

 

You can however modiy the layer where the text/mtext is currently assigned and change the linewight to 30 and change all text/mtext LW property to bylayer.. (just a thought)

Posted
Thanks for the quick reply. Its nice to have this in both versions. The program worked great. This is exactly what we were looking for.

Thanks again.

 

Great, good for you bgerico

 

here's another one

(defun c:MTLwt  (/ ss e i)
     (vl-load-com)
     (if (setq ss   (ssget "_X"
                           '((0 . "*TEXT") (-4 . "<=") (370 . 30))))
           (repeat (setq i (sslength ss))
                 (vla-put-lineweight
                       (setq e    (vlax-ename->vla-object
                                        (ssname ss (setq i (1- i)))))
                       30))
           )
     (princ)
     )

 

Enjoy :)

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