PDA

View Full Version : Changing LineTypes within MLSTYLE


sthedens
2006-03-06, 08:42 PM
I know how to use the subst / entmod functions to alter the parameters of an entity.

How can I isolate a specific linetype in a MLINESTYLE definition? For instance, if the definition of a MLINESTYLE is:

Top Line: "Continuous"
Mid Line: "Center"
Bottom Line: "Continuous"

And I want to change the Linetype "Center" to "Divide".

Each of the LineTypes is defined in the MLINESTYLE with (6 . LineType). So doing a (setq e (subst '(6. "Divide") (assoc 6 e)e)) will replace all Linetypes with "Divide". I just want to replace the LineType of the middle line.

Steve

sthedens
2006-03-08, 08:51 PM
I can do the following:

(setq e (subst '(6. "Center") '(6 . "Divide") e))

But then:

(entmod e)

returns a nil, and the MLSTYLE remains as previously defined.

Steve

kennet.sjoberg
2006-03-08, 09:40 PM
Steve, I think it is much more harder than that
you can not treat a mline as an ordinary line.

I will try to help you if time comes,
but in the mean time you can start to create a second type of MLINE.

: ) Happy Computing !

kennet

sthedens
2006-03-09, 06:03 PM
Kennet,

I'm "entity mining" to get from the user selected MLINE entity to the MLINESTYLE definition which is also an entity. I was then performing the subst function on the MLINESTYLE, that successfully completes. It's the entmod function that will not work on the MLINESTYLE entity. I wasn't surprised by this, but thought I would give it a try.

I've got another post in the General AutoCAD forum regarding my frustration with lack of ability to alter an existing MLINESTYLE definition:
http://forums.augi.com/showthread.php?t=35044

Something is causing our MLINESTYLEs to be incorrectly defined. To correct it, the user has to delete the MLINE graphics drawn with this corrupted Style, purge the Style, fix the definition, then redraw the MLINE graphics.

If I could just programatically redefine the Dictionary definition of the MLINESTYLE, the user wouldn't need to interactively clean things up.

but in the mean time you can start to create a second type of MLINE.

I did create a new MLINESTYLE that is correctly defined. I wish there was a way to change the assigned MLINESTYLE to an existing MLINE graphic.

Steve

Opie
2006-03-09, 06:14 PM
Brainstorming here.

What would happen if you copied to the clipboard the mline's for the mlstyle you wanted to modify, delete from the drawing the copied mlines, modified the mlstyle, and then pasted the copied mlines back into the drawing?

I don't use mlines to really be of any help.

sthedens
2006-03-09, 08:07 PM
What would happen if you copied to the clipboard the mline's for the mlstyle you wanted to modify, delete from the drawing the copied mlines, modified the mlstyle, and then pasted the copied mlines back into the drawing?

Good idea, but it didn't work. The pasted MLINES come in with MLINESTYLE value of CABLETRAY1. CABLETRAY1 matches the bad definition the MLINES had when they were copied to the clipboard. Subsequent pastes increment the MLINESTYLE name, CABLETRAY2, CABLETRAY3, etc.

Opie
2006-03-09, 08:16 PM
Good idea, but it didn't work. The pasted MLINES come in with MLINESTYLE value of CABLETRAY1. CABLETRAY1 matches the bad definition the MLINES had when they were copied to the clipboard. Subsequent pastes increment the MLINESTYLE name, CABLETRAY2, CABLETRAY3, etc.
I guess MLINES are not very customizable, from a programming stand point. That's not good.

I also tried to modify the style. No luck.

I also tried to change the name of the style within the MLINE entity. No luck.

According to the help file, the style name for the MLINE object property is read-only.

You may want to extract the coordinates from the object and programatically create a new mline (with the correct style).

jwanstaett
2006-03-09, 08:43 PM
I am use AutoCAD 2002 and you can not change the mlstyle using AutoCAD with out save and reloading the mlstyle. and if the mlstyle is in use can not change it. this is why you can not change to mlstyle with lisp you can not do it in AutoCAD. this may have change.

Opie
2006-03-09, 09:07 PM
I am use AutoCAD 2002 and you can not change the mlstyle using AutoCAD with out save and reloading the mlstyle. and if the mlstyle is in use can not change it. this is why you can not change to mlstyle with lisp you can not do it in AutoCAD. this may have change.

It has not changed in 2006, so I doubt that is will change any time soon. This might be a good idea for a wish (http://www.augi.com/autocad/submitwish.asp).

sthedens
2006-03-09, 09:26 PM
According to the help file, the style name for the MLINE object property is read-only.

Obviously, it's not as "read-only" as they would like it to be. Somehow, the definition is being altered. Without knowing the inner-workings of acad.exe or the .dwg file format, I don't see why MLINESTYLEs should be different than any other parameter.

1. A User should be able to re-assign an existing MLINE to a different MLINESTYLE.
2. A User should be able to redefine an existing MLINESTYLE while there are graphics on the drawing using that MLINESTYLE.

Steve

kennet.sjoberg
2006-03-09, 11:39 PM
. . . I don't see why MLINESTYLEs should be different than any other parameter.I do fully agree with you, but there is reactors involved.
It should be possible to at least use Command: _MATCHPROP to change mline, but you can not.
In my opinion it is more like difference in objects, than a font difference.
I have spent a few hours to rewrite dxf codes successfully, but not been able to update them.

I have no good suggestions how to "change Mline to Mline", other than to replace them.
( Select mline, save coordinates, erase mline, insert new mline, seems like matchprop )
But there is a lot of clever users in AUGI that may step in and maybe solve your problem.

: ) Happy Computing !

kennet

sthedens
2006-03-10, 04:59 PM
I have spent a few hours to rewrite dxf codes successfully, but not been able to update them.
Thanks for the efforts, I hit this same wall as well.

But there is a lot of clever users in AUGI that may step in and maybe solve your problem.
I certainly hope so, but I'm not too optimistic. I've run out of "clever" myself on this issue.

Thanks everyone for your suggestions. I'm going to avoid the use of MLINES in the meantime.

Steve

rornelas
2008-08-15, 07:59 PM
I wonder if it would be possible to write a LISP or VBA routine that would iterate through each multiline, get the vertices of the multiline, and redraw the multiline with a user-input MLSTYLE. then the program deletes the original Multiline and repeats the procedure for all multilines in a drawing?