Jump to content

Recommended Posts

Posted

I am wondering if there is anyway to export just the lineweight settings from a drawing? I know with the Layer State file if exports all of the layer settings, but I am just in need of the lineweights...if that makes any sense....what is happening is this, we are currently working on a project that must be delivered as a Bently dgn files to the customer which will require the graphics to all have lineweights assigned and displayed in order to plot the files correctly. Bently doesn't use ctb files and such to plot with....so I am in hopes of some way to go into these sheets and assign lineweights to the graphics without having to do each sheet by hand...as the project is about 70 sheets.....:?

 

Does anyone know of a way that we can address this issue in a fairly easy manner...? Maybe a lisp or something that would take care of it....:unsure:

 

Thanx so much for any and all help that you can offer me with this....:roll:

 

Anita

Posted

If you want to make the lineweights of the objects Bylayer, you can make a "template" from one of your existing dwg and edit the lineweights of the layers in the layer manager. Then use the Laytrans command.

j1.JPG

Posted

In doing this....will it just translate the LW's or will it translate all the layer properties? Seems that all we need to assign are the lineweights....allowing all the other layer settings to remain as they currently are in each individual drawing.....does that make sense?

Posted

Any code writers out there? I stumbled across this partial code and think it would work for my needs...but I can't figure out just how to make it work....I don't understand writing code at all......

 

Here is what I found:

 

(defun c:assignlineweights ( / layers_col col)

(vl-load-com)

(or *acaddoc* (setq *acaddoc* (vla-get-activedocument (vlax-get-acad-object))))

(setq layers_col (vla-get-layers *acaddoc*))

(vlax-for item layers_col

(setq col (vlax-get-property item 'color))

(cond ((= col 1)(vlax-put-property item 'LineWeight acLnWt005))

((= col 2)(vlax-put-property item 'LineWeight acLnWt018))

((= col 3)(vlax-put-property item 'LineWeight acLnWt060));copy down and change to suit

 

)

)

(princ)

)

 

 

 

 

Can someone please take a look at this and tell me what I have to do to make this work? I have tried using it just as it is...but it fails.....I loaded it through appload as a .lsp file....was that correct?

 

Thanx so much...Anita :roll:

Posted

I kinda got it to work...

after the (cond line where it says = col 1 means if the layer's color is 1 (red) then put the layer's lineweight = acLnWt005. I'm not entirely sure but I think the lineweights are metric (e.g. acLnWt060 = 0.60 mm).

You'll need to populate the (cond with the appropriate colors versus lineweights for your needs following the pattern of

((= col 1)(vlax-put-property item 'LineWeight acLnWt005))

 

The lineweights you need to use (I think...) are listed in Help > Developer Documentation > ActiveX Reference > Properties > Lineweight property

 

(defun c:assignlineweights ( / layers_col col)
(vl-load-com)
(setq *acaddoc* (vla-get-activedocument (vlax-get-acad-object)))
(setq layers_col (vla-get-layers *acaddoc*))
(vlax-for item layers_col
(setq col (vlax-get-property item 'color))
(cond
     ((= col 1)(vlax-put-property item 'LineWeight acLnWt005))
     ((= col 2)(vlax-put-property item 'LineWeight acLnWt009))
     ((= col 3)(vlax-put-property item 'LineWeight acLnWt060));copy down and change to suit
     ((= col 4)(vlax-put-property item 'LineWeight acLnWt030))
)
)
(princ)
)

Posted

Thanx for your help with this....I tried to run it after I went through the code and added all the lines to cover the 256 colors that are available....and when I ran it...this is the error message that I got....

 

error: ActiveX Server returned an error: Parameter not optional

 

I am going to try to post my file....so that maybe you or someone else can take a look at it and tell me what is wrong. Sure hope this thing can be fixed to make it work.....

 

Thanx so much....Anita

 

I'll have to post the code in another post here....it makes my reply too long....

Posted

Did you happen to use a lineweight (acLnWtXXX) that was not on the list shown in Help?

Also, color 256 (ByLayer) isn't allowed for a layer, you might want to get rid of that one.

Posted

Okay...after doing some more research I have determined that the lineweights as was stated in an earlier post must be in the activeX format. So now my dilemma is this...how do I determine which activeX lineweight correlates to a corresponding Acad lineweight...is there a formula that I can use to help me figure this out....I have a .ctb file that gives me the assigned Acad weight for each pen, but I don't know how to make that number work in my code since it is requiring the ActiveX weight assignment.....sure hope this makes sense to someone out there, cause it has completely flown over my head and I wrote it!!!!

 

Thanx...Anita:cry:

Posted

AcLnWt060 = 0.60mm = 0.024"

 

60 x 0.0004 = 0.024

Posted

In my realm of blissful stupidity....or as I like to refer to it as "My World"....when I put the lineweights into my code file this is what I did....I opened the corresponding .ctb file and went through it one pen at a time and using the weight that was assigned in this file in my code....such as "AcLnWt0140" with the "0140" being the weight that was assigned in the .ctb file....so now what I need to do is figure out how to convert those numbers to an ActiveX weight that will correspond to the weight used in the .ctb file. Does that make sense? Also the weights that are assigned in the .ctb file are in inches not mm's....does this make a difference as well....this is all so confusing to me.....for I am not a programmer at all....I just use cad....not write it! So this is a huge undertaking for me.....:oops:

 

I hope this all makes sense to you.....and maybe you can supply me with a formula to convert all the weights that I have put into my code to the correct ActiveX format...

 

Thanx so much for your help and time....Anita:shock:

Posted

I thought I did in my last post (and in post #6)

Here is an excerpt from the Developer Documentation I alluded to in post #6

Lineweight property

 

Lineweight

 

acLnWt000

acLnWt005

acLnWt009

acLnWt013

acLnWt015

acLnWt018

acLnWt020

acLnWt025

acLnWt030

acLnWt035

acLnWt040

acLnWt050

acLnWt053

acLnWt060

acLnWt070

acLnWt080

acLnWt090

acLnWt100

acLnWt106

acLnWt120

acLnWt140

acLnWt158

acLnWt200

acLnWt211

 

Are the lineweights in your ctb file metric or imperial? If you post it I'll try and figure it out.

Posted

Sorry for being so dense with this....the ctb file reflects imperial units....I am going to try to attach the file in this post....It looks like I can't attach a .ctb file here...I tried and it told me it was an invalid file type for upload.....so if you will send me an email address I'll email it to you....or I'll try to post here some of the lineweights that I see in the file.....

 

.0070"

.0098"

.0140"

.0197"

.0390"

.0550"

.0138"

.0035"

.0280"

.0790"

.0200"

.0100"

 

These are the primary weights that are being used in the ctb file, and they just keep repeating throughout the file....

 

Hope this helps.....Anita:?

Posted

Try this

 

.0070" acLnWt018

.0098" acLnWt025

.0140" acLnWt035

.0197" acLnWt050

.0390" acLnWt100

.0550" acLnWt140

.0138" acLnWt035

.0035" acLnWt009

.0280" acLnWt070

.0790" acLnWt200

.0200" acLnWt050

.0100" acLnWt025

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