Jump to content

Multiple command .Lisp Routine Advice pls.


skipsophrenic

Recommended Posts

If it is possible i will go away and try write it myself, :unsure:

 

just wondering, we've come across a problem at work sice upgrading from 2004 to 2008, and the only way to fix it is by opening every dwg and following steps in attatched pdf.

 

Is it possible for a lisp routine to be written to do this and then assigned to a button of your choosing?

 

Thanks in advance

 

Skipsophrenic the nutter:D

 

AutoCAD 2008 Glitch fix.pdf

Link to comment
Share on other sites

firstly, I don't think you need to repeat every step in those instructions. Where it says "repeat steps x-x" you should be able to use the "previous" selection set.

 

this should give you a clue as to how to address the problem. you need to create a selection set in either LISP or VBA - each allows you to build filters to ensure you only get the text you require. From there on it is (it seems) quite simple - not that I'm offering to do it.

 

I have not seen this particular problem (at least not noticed it!) so I wait to see your efforts and hope I don't need it.

Link to comment
Share on other sites

all it is, is that the mtext has "Covered the drawing", with too high defined height. but still needing to do the other steps to get the drawing back (annoying) I hope nobody else needs to puzzle it out either, we think its to do with how ACAD 2008 deals with mtxt vs how ACAD 2004 does. (Why do autodesk change a perfectly good platform.)

 

and don't worry - i'm not gonna ask anybody else to write the code for me - maybe tell me where i gone wrong, but not write it, that would be cheating - I think :?

Link to comment
Share on other sites

creating selection sets is well covered here, do a search. You may need a little help in defining the syntax but try selecting all MTEXT first - somebody will then be able to help with the MTEXT AND bits.

 

what language are you hoping to learn? LISP or VBA?

Link to comment
Share on other sites

and have you started with either yet?

 

The following is a bit of VBA that will select ALL MText within the drawing. I can't work out in your routine why you should select text NOT of a certain colour rather than all text - any ideas?

 

Having made your selection set you can perform actions on that set. What I can't find is how to set "Defined Height" though. It must be possible but I can't see it. It may only be available through LISP.

 

Public Sub BangMText()
'Dim myObject As Object
Dim mySelectionSet As AcadSelectionSet
Set mySelectionSet = ThisDrawing.SelectionSets.Add("MText")
Dim gpCode(0) As Integer
Dim dataValue(0) As Variant
Dim groupCode As Variant
Dim dataCode As Variant
gpCode(0) = 0 'item
groupCode = gpCode
dataValue(0) = "MTEXT" 'item type
dataCode = dataValue
mySelectionSet.Select acSelectionSetAll, , , groupCode, dataCode
Debug.Print mySelectionSet.Count

ThisDrawing.SelectionSets.Item("MText").Delete

End Sub

Link to comment
Share on other sites

Deletes all not Red MText.

 

Public Sub DeleteNotRedMText()

Dim mySelectionSet As AcadSelectionSet
Set mySelectionSet = ThisDrawing.SelectionSets.Add("MText")
[color="Blue"]Dim filCode(0 To 3) As Integer[/color]
[color="#0000ff"]Dim filVal(0 To 3) As Variant[/color]
Dim cTxt As AcadMText

[color="#0000ff"]filCode(0) = 0: filCode(1) = -4: filCode(2) = 62: filCode(3) = -4[/color]
[color="#0000ff"]filVal(0) = "MTEXT": filVal(1) = "<NOT": filVal(2) = 1: filVal(3) = "NOT>"[/color]
mySelectionSet.Select acSelectionSetAll, , , filCode, filVal

For Each cTxt In mySelectionSet
   cTxt.Delete
Next cTxt

ThisDrawing.SelectionSets.Item("MText").Delete

End Sub

Link to comment
Share on other sites

and have you started with either yet?

 

The following is a bit of VBA that will select ALL MText within the drawing. I can't work out in your routine why you should select text NOT of a certain colour rather than all text - any ideas?

 

End Sub[/code]

 

Because that was the only way i could figure out how to select the mtext and not normal text as well, (Maybe i need a refresher cousre on cad full stop:? )

 

Thnks to you, the best part of the lot is all of the code that i have written so far is two lines

Link to comment
Share on other sites

I took your instructions at face value assuming you had found them somewhere. How much of that do you actually have to do? "Defined Height" appears to be the height of the text box, not the text itself so shouldn't really "cover the drawing". Another thing, do you need to move the text by an amount? Can't you just move it by 0?

 

Can you post a "damaged" drawing so that i can have a look as I haven't encountered this problem yet. (I do have a different one with text though)

Link to comment
Share on other sites

i'll have to wait untill i get home 'cos i havent got a copy here at work at the moment. (Wish i had)

 

and unfortunately i didn't find those instructions, i was asked to type them up so as could be distributed around our office

 

RE: QSELECT comment :oops: NOW I FEEL DAFT!!! one of basic things i should have known!

Link to comment
Share on other sites

ok, a lot of what you are doing is not needed. I assume you are trying to get rid of the vertical "stripes" created by the MTEXT?

 

How about:

select all MTEXT (QSELECT)

set defined height = 0 (use properties)

save drawing

 

Next time you open the drawing it will have done all the regeneration needed.

Link to comment
Share on other sites

ok, now i feel dumb,:oops: thnx 4 remindin me the quick way dbroadba, :thumbsup:

(i always overcomplicate things - that what said in last review anyway)

Link to comment
Share on other sites

(Why do autodesk change a perfectly good platform.)

 

I have been the same for years. However, changes are a neccesary evil

 

If it didn't update it would die out. My acad skills become redundant

When it updates, My acad skills become redundant

Link to comment
Share on other sites

FOUND THE PROBLEM! The background mask in mtext was set to somethin RIDICULOUS, after qselecting everythin, i just turned off the background mask, and problem go bye-bye

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