TheSwamp

CAD Forums => CAD General => Topic started by: deegeecees on September 13, 2005, 01:25:12 PM

Title: Lets Build!
Post by: deegeecees on September 13, 2005, 01:25:12 PM
It seems that the coding has hit a minor lull in TheSwamp. I'd like to start a new project that everyone can add to, and something that everyone can use. Here's a list of ideas for possible projects:

- TheSwamps' own All-In-One Batch Processor (for Titleblocks, plotting etc.)
- TheSwamps' own Text Editor for AutoCAD
- TheSwamps' own Autoloading Menu (a suite of utilities for all)

To name just a few. My idea is to create one (or all) with the mindset that it can be distributable opensource code with loading executables and the works, really load it up with user freindly features that are adaptable to anyones configuration. Anyone else on board?
Title: Re: Lets Build!
Post by: David Hall on September 13, 2005, 01:47:57 PM
lisp or VBA?
Title: Re: Lets Build!
Post by: David Hall on September 13, 2005, 01:50:24 PM
Here is my text editor for editing any type of text
Code: [Select]
(defun C:ED (/ TX TXT EN)
  (defun *error* (m)
    (princ "\nTry Again....")
    (c:ed)
    (setvar "cmdecho" CE)
  )
  (setq CE (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (prompt "\nSelect text for editing....")
  (setq TX (entget (car (entsel))))
  (setq TXT (cdr (assoc 0 TX)))
  (setq EN (cdr (assoc -1 TX)))
  (if (= TXT "INSERT")
    (command "DDATTE" EN)
    (if (= TXT "DIMENSION")
      (command "DDEDIT" EN)
      (if (= TXT "TEXT")
(command "DDEDIT" EN "")
(if (= TXT "MTEXT")
  (command "DDEDIT" EN "")
  (if (= TXT "ATTDEF")
    (command "DDEDIT" EN "")
    (progn (prompt
     "n\nEntity not an attribute or text:"
   )
   (*ERROR*)
    )
  )
)
      )
    )
  )
  (setq TX  nil
TXT nil
EN  nil
M   nil
  )
  (princ)
  (setvar "cmdecho" CE)
)


It could be updated with COND statement to get rid of all the IF satatements
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 01:51:08 PM
Lisp for the easy stuff, VBA for the application/event driven stuff. I'm not sure if you could create a text editor written in Lisp.
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 01:52:28 PM
I'm talking about the actual GUI for the editor.
Title: Re: Lets Build!
Post by: Chuck Gabriel on September 13, 2005, 02:06:07 PM
I'm not sure if you could create a text editor written in Lisp.

Them's fightin words for some folks. :D
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 02:08:05 PM
I'm not sure if you could create a text editor written in Lisp.

Them's fightin words for some folks. :D

I'm not saying its "Impossible", just that it may or may not be feasible.
Title: Re: Lets Build!
Post by: ELOQUINTET on September 13, 2005, 02:31:08 PM
i'm not much of a programmer (and maybe this will help in that department) but i am a good brainstormer and tester. so i'm all for the idea.
Title: Re: Lets Build!
Post by: Bob Wahr on September 13, 2005, 02:32:07 PM
- TheSwamps' own All-In-One Batch Processor (for Titleblocks, plotting etc.)
I'm not sure what you want it to do.
Quote from: deegeecees
- TheSwamps' own Autoloading Menu (a suite of utilities for all)
Again, I'm not really sure what you're wanting.
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 02:41:27 PM
Batch Processor:
- Multiple block/attribute selection for changes (i.e. revision, date, etc.)
- Dialog Box driven GUI with options for plotting, file selection and more
- Any other process that you can think of

Autoloading Menu:
- A Swamp Menu with a plethera of utilities created by us (whatever us as a whole decide upon) that has its own installer, help file etc., think "Express Tools", only change it to "Swamp Tools".
Title: Re: Lets Build!
Post by: Murphy on September 13, 2005, 02:57:27 PM
Count me in!!!
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 03:03:04 PM
I'm just coming up with ideas, anything anyone else wants, add it to the list. I just see a lot less code storming, so I thought I'd try and spark up a cool project that would be educational and maybe have a few laughs too. I know people have things to do, and there are currently not enough hours in the day, but I figure if we start something it'll be there tomorrow or the next day, whenever someone gets to it.
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 03:06:47 PM
ELO - We could sure use a beta tester!  8-)

OK Murph!  :mrgreen:
Title: Re: Lets Build!
Post by: ELOQUINTET on September 13, 2005, 03:23:27 PM
as long as smoke doesn't start pouring from my tower i'm in  ;-)
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 03:37:55 PM
I cant make any guarantees.
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 03:45:38 PM
I'm gonna let this thread rest for a day. After that, whoever joined up will be the decision makers for the project startup. Here's what we've got thus far:

Deeg
Eloquintet
Murphy
Bob W (I think)
Title: Re: Lets Build!
Post by: Bob Wahr on September 13, 2005, 04:11:16 PM
Can't guarantee how much time I will have on a regular basis to devote to the project and so far, don't see any ideas that I would use much with the possible exception of the text editor (Not a big fan of in-place editing (which is forced on you for mtext in 2006 (unless someone has found a way to turn it off that I couldn't (which would make me oh so happy)))) but I enjoy writing code and often can't come up with ideas for things to write so I'm definitely in.
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 04:17:09 PM
Bob,
I don't have 2006 in front of me, so I'm not sure if this is still valid. In the Options, under the Support Files Tab there is the Text Editor portion that you can specify either "Internal" or something such as "NotePad". Hopefully you're a happy camper)))).

Pat
Title: Re: Lets Build!
Post by: MikePerry on September 13, 2005, 04:19:44 PM
(Not a big fan of in-place editing (which is forced on you for mtext in 2006 (unless someone has found a way to turn it off that I couldn't (which would make me oh so happy))))
Hi

Check out the following links in this post - AutoCAD 2006 breaking info (http://www.theswamp.org/forum/index.php?topic=3058.msg52625#msg52625)

"AutoCAD 2006 Tip: How to get the old Mtext fixed editor back" by Shaan Hurley

"AutoCAD 2006 - Solution when editing rotated text" by Jimmy Bergmark

"Single Line Text Tip for AutoCAD 2006" by Lynn Allen

"Getting AutoCAD 2006 DTEXT to behave!" by Lynn Allen

Have a good one, Mike
Title: Re: Lets Build!
Post by: Bob Wahr on September 13, 2005, 04:28:24 PM
Thanks Mike.

"AutoCAD 2006 Tip: How to get the old Mtext fixed editor back" by Shaan Hurley

is exactly what I was after.
Title: Re: Lets Build!
Post by: ronjonp on September 13, 2005, 05:49:57 PM
If we make an installer for all the routines, a help file is going to need to be made to find anything.

I have some experience with Acadinstall and inno setup. Currently my written/collected lisp routines are in an installer and work from acad2000-2005
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 05:54:30 PM
Welcome aboard RonJon!
Title: Re: Lets Build!
Post by: David Hall on September 13, 2005, 06:01:14 PM
Count me in.  I have a GUI text editor that is very simple, maybe we can build on that
Title: Re: Lets Build!
Post by: deegeecees on September 13, 2005, 06:06:35 PM
<saluting> Welcome aboard Commander!
Title: Re: Lets Build!
Post by: Andrea on September 13, 2005, 11:15:37 PM
Hyper Text
http://www.caddepot.com/cgi-bin/cfiles/cfiles.cgi?0,0,0,0,5,2033


BLP Batch Lisp Processor
http://www.caddepot.com/cgi-bin/cfiles/cfiles.cgi?0,40,0,0,47

and finally....DTE (Dtext Editor release 1.1)
see screenshot below. (created on since AutoCAD 2000i)


Title: Re: Lets Build!
Post by: hudster on September 14, 2005, 03:40:24 AM
Batch Processor:
- Multiple block/attribute selection for changes (i.e. revision, date, etc.)
- Dialog Box driven GUI with options for plotting, file selection and more
- Any other process that you can think of

the ability to process more than one drawing would be nice as well.
Title: Re: Lets Build!
Post by: Andrea on September 14, 2005, 12:29:15 PM
the ability to process more than one drawing would be nice as well.


Batch LISP Processor...
Title: Re: Lets Build!
Post by: t-bear on September 14, 2005, 01:15:30 PM
This could be fun....let me dig around and see what I have rat-holed away........
Title: Re: Lets Build!
Post by: Murphy on September 14, 2005, 01:41:40 PM
Looks as though this is going the way of LISP.  :ugly:
 I have limited knowledge of that language so, I will be of limited help. I will do my best though.  :mrgreen:
Title: Re: Lets Build!
Post by: Bob Wahr on September 14, 2005, 01:43:59 PM
I'll toss this in for the useless utilities section.  Think mirrtext 0 only for blocks and retroactively.
Code: [Select]
Option Explicit

Public Sub UnMirror()
On Error GoTo ErrorControl
  
  Dim strSet As String
  Dim intGroup() As Integer
  Dim varGroup() As Variant
  Dim varAtts As Variant
  Dim objSelSet As AcadSelectionSet
  Dim objSelSets As AcadSelectionSets
  Dim strBlkName As String
  Dim PI As Double
  Dim strSetName As String
  Dim objBlkRef As AcadBlockReference
  Dim objEnt As AcadEntity
  Dim intCnt As Integer
  
  PI = (Atn(1) * 4)
  Set objSelSets = ThisDrawing.SelectionSets
  strSetName = 1
  ReDim intGroup(0)
  ReDim varGroup(0)
  intGroup(0) = 0
  varGroup(0) = "insert"

BlockName:
  strBlkName = ThisDrawing.Utility.GetString(True, "Block to unmirror [All, Select, <default block name goes here>]:")
  If strBlkName = "" Or Left(strBlkName, 1) = " " Then
    ReDim Preserve intGroup(0 To 1)
    ReDim Preserve varGroup(0 To 1)
    intGroup(1) = 2
    varGroup(1) = "defaultblockname"
  ElseIf StrComp(strBlkName, "a", vbTextCompare) = 0 Or StrComp(strBlkName, "all", vbTextCompare) = 0 Then
    ReDim Preserve intGroup(0 To 1)
    ReDim Preserve varGroup(0 To 1)
    intGroup(1) = 2
    varGroup(1) = "*"
  ElseIf StrComp(strBlkName, "s", vbTextCompare) = 0 Or StrComp(strBlkName, "sel", vbTextCompare) = 0 Or StrComp(strBlkName, "select", vbTextCompare) = 0 Then
    KillSet strSetName
    Set objSelSet = objSelSets.Add(strSetName)
    objSelSet.SelectOnScreen intGroup, varGroup
    ReDim intGroup(0 To (objSelSet.Count) + 1)
    ReDim varGroup(0 To (objSelSet.Count) + 1)
    intGroup(0) = -4
    varGroup(0) = "<or"
    intGroup((objSelSet.Count) + 1) = -4
    varGroup((objSelSet.Count) + 1) = "or>"
    
    For intCnt = 1 To objSelSet.Count
      If TypeOf objSelSet.Item(intCnt - 1) Is AcadBlockReference Then
        Set objBlkRef = objSelSet.Item(intCnt - 1)
        intGroup(intCnt) = 2
        varGroup(intCnt) = objBlkRef.Name
      End If
    Next intCnt
  Else
    ReDim Preserve intGroup(0 To 1)
    ReDim Preserve varGroup(0 To 1)
    intGroup(1) = 2
    varGroup(1) = strBlkName
  End If
  
  KillSet strSetName
  Set objSelSet = objSelSets.Add(strSetName)
  objSelSet.Select acSelectionSetAll, , , intGroup, varGroup
  
  If objSelSet.Count > 0 Then
    GoTo FollowTheRabbit
  Else
    ThisDrawing.Utility.Prompt vbCrLf & "**No Blocks Selected**" & vbCrLf
    GoTo ExitHere
  End If
  
FollowTheRabbit:
  Dim dblMSpc As Double
  Dim dblPSpc As Double
  Dim dblRotRad As Double
  Dim dblRotDeg As Double
  Dim dblScale(0 To 2) As Double
  Dim dblInsPt(0 To 2) As Double
  Dim objNewRef As AcadBlockReference
  Dim varOldAtt As Variant
  Dim varNewAtt As Variant
  
  dblMSpc = ThisDrawing.ModelSpace.ObjectID
  dblPSpc = ThisDrawing.PaperSpace.ObjectID
  
    For Each objEnt In objSelSet
      If TypeOf objEnt Is AcadBlockReference Then
        Set objBlkRef = objEnt
        If objBlkRef.XScaleFactor < 0 Then
          dblInsPt(0) = objBlkRef.InsertionPoint(0)
          dblInsPt(1) = objBlkRef.InsertionPoint(1)
          dblInsPt(2) = objBlkRef.InsertionPoint(2)
          dblScale(0) = objBlkRef.XScaleFactor * -1
          dblScale(1) = objBlkRef.YScaleFactor
          dblScale(2) = objBlkRef.ZScaleFactor
          dblRotRad = objBlkRef.Rotation
          dblRotDeg = (dblRotRad * 180) / PI
          If dblRotDeg > 120 And dblRotDeg < 330 Then
            dblRotDeg = dblRotDeg + 180
            If dblRotDeg > 360 Then
              dblRotDeg = dblRotDeg - 360
            End If
            dblRotRad = (PI * dblRotDeg) / 180
          End If
          If objBlkRef.OwnerID = dblMSpc Then
            Set objNewRef = ThisDrawing.ModelSpace.InsertBlock(dblInsPt, objBlkRef.Name, dblScale(0), dblScale(1), dblScale(2), dblRotRad)
            If objNewRef.HasAttributes Then
              varOldAtt = objBlkRef.GetAttributes
              varNewAtt = objNewRef.GetAttributes
              For intCnt = 0 To UBound(varOldAtt)
                varNewAtt(intCnt).TextString = varOldAtt(intCnt).TextString
              Next intCnt
            End If
            objNewRef.Layer = objBlkRef.Layer
            objNewRef.Linetype = objBlkRef.Linetype
            objNewRef.LinetypeScale = objBlkRef.LinetypeScale
            objNewRef.Lineweight = objBlkRef.Lineweight
            If Left(ThisDrawing.GetVariable("acadver"), 2) = "16" Then
              objNewRef.TrueColor = objBlkRef.TrueColor
            Else
              objNewRef.color = objBlkRef.color
            End If
            objNewRef.Visible = objBlkRef.Visible
            objBlkRef.Delete
            objNewRef.Update
          Else
            Set objNewRef = ThisDrawing.PaperSpace.InsertBlock(dblInsPt, objBlkRef.Name, dblScale(0), dblScale(1), dblScale(2), dblRotRad)
            If objNewRef.HasAttributes Then
              varOldAtt = objBlkRef.GetAttributes
              varNewAtt = objNewRef.GetAttributes
              For intCnt = 0 To UBound(varOldAtt)
                varNewAtt(intCnt).TextString = varOldAtt(intCnt).TextString
              Next intCnt
            End If
            objNewRef.Layer = objBlkRef.Layer
            objNewRef.Linetype = objBlkRef.Linetype
            objNewRef.LinetypeScale = objBlkRef.LinetypeScale
            objNewRef.Lineweight = objBlkRef.Lineweight
            If Left(ThisDrawing.GetVariable("acadver"), 2) = "16" Then
              objNewRef.TrueColor = objBlkRef.TrueColor
            Else
              objNewRef.color = objBlkRef.color
            End If
            objNewRef.Visible = objBlkRef.Visible
            objBlkRef.Delete
            objNewRef.Update
            End If
        End If
      End If
    Next objEnt
      
ExitHere:
Exit Sub

ErrorControl:
  Select Case Err.Number
    Case Else
      MsgBox "''" & Err.Description & "'' error has occured in UnMirror" & vbCr & _
      "All Blocks May NOT have updated correctly" & vbCrLf & _
      "Please report the error to Eric Bussey", vbCritical, "Error in UnMirror"
      GoTo ExitHere
  End Select
 


End Sub

Function KillSet(strSet As String)
  Dim objSelSet As AcadSelectionSet
  Dim objSelSets As AcadSelectionSets
  
  Set objSelSets = ThisDrawing.SelectionSets
      
  For Each objSelSet In objSelSets
    If objSelSet.Name = strSet Then
      ThisDrawing.SelectionSets.Item(strSet).Delete
    Exit For
    End If
  Next

End Function
 Threw it together quickly for a specific need, then went back and added additional functionality.  Was going to go back and take a long look at it later but never did.  It works though.
Title: Re: Lets Build!
Post by: Bob Wahr on September 14, 2005, 01:45:28 PM
Looks as though this is going the way of LISP. :ugly:
 I have limited knowledge of that language so, I will be of limited help. I will do my best though. :mrgreen:
I'm personally going to ignore all efforts to lispify it.
Title: Re: Lets Build!
Post by: Murphy on September 14, 2005, 03:11:14 PM
Sounds good to me.  :-D
Title: Re: Lets Build!
Post by: Andrea on September 14, 2005, 03:19:37 PM
Take a look of this..

http://management.cadalyst.com/cadman/article/articleDetail.jsp?id=101853
Title: Re: Lets Build!
Post by: deegeecees on September 14, 2005, 03:32:14 PM
Here's a thought:

..........................


No, really:

VBA vs. Lisp?
Title: Re: Lets Build!
Post by: Bob Wahr on September 14, 2005, 03:43:36 PM
No holds barred?

Cage match??

Ladder match???

For the undisputed heavyweight championship of acad????

Nah, it's a crap battle that boils down to person vs person with rules too hard to define and an outcome that doesn't matter.  What I said wasn't intended to be a slam on lisp.  All I was saying was that my lisp sucks and if I was going to take part, the part that I take would have to be a VBAish part so IF the project took a turn towards lisp only, I would ignore the turn and keep contributing what I was able to contribute as I had time to contribute it.
Title: Re: Lets Build!
Post by: whdjr on September 14, 2005, 05:49:10 PM
I would take the opposite stand from Bob as I only know Lisp and not VBA. :mrgreen:
Title: Re: Lets Build!
Post by: deegeecees on September 14, 2005, 06:35:41 PM
Thats fine, I'll direct traffic as I know both.
Title: Re: Lets Build!
Post by: Andrea on September 14, 2005, 10:00:52 PM
for my own...

I had bad experience with VBA...

all program made with VBA for AutoCAD...
AutoCAD need to load all the VBA module.

So this is a little heavy for AutoCAD.

Also, if you need to update MSOffice...Be careful..
because Office have a VBA module too...and re-install over the old release...
so after that, you can not load VBA module in AutoCAD....need to re-install-it.

I know that.....I'm paid to make tests !! ^-^
Title: Re: Lets Build!
Post by: MP on September 14, 2005, 10:04:03 PM
VBA is fine for casual programming but it's not suited to building utilities like the ones being suggested in this thread (IMO). Visual BASIC (Pro or Enterprise) on the other hand is perfectly fine, as is Delphi, VC ...
Title: Re: Lets Build!
Post by: Murphy on September 15, 2005, 06:02:13 AM
I have created numerous stuff in VBA. Look at my sig for a Spanner-type program that runs in Excel.
I have also done 'batch' stuff in VBA. Only problems I have encountered is with referencing the correct versions of programs.
I do not have C++ or VB so, go forward with what you want.

Thanks for the ideas, though.
Title: Re: Lets Build!
Post by: deegeecees on September 20, 2005, 02:16:42 PM
Okay, I'm keeping this thread alive so, bear with me here. I have a TON of grunt work to do here at my place of employment which is why I have been so sparse on the witty banter here in the swamp. As soon as I catch up at work, I'll catch up here  --><--

BTW, I really like this smiley  :ugly:
Title: Re: Lets Build!
Post by: MvdP on September 23, 2005, 12:29:03 PM
Keeping this thread alive......!!!!!!!
Title: Re: Lets Build!
Post by: deegeecees on September 23, 2005, 01:13:19 PM
It's gonna be a while till I get some "spare" time. I've just realized a project here that needs coding. We (at work) handle many different accounts, which in turn lends itself to multiple "groups", which in turn makes use of multiple CAD configurations (i.e. directory structures, titleblocks, and layout elements), as well as multiple disciplines. I'm undertaking the monumental task of creating custom AutoCAD, and (yes, I hate it) Microstation interfaces. This is no easy task as there is absolutley no rhyme or reason to what is currently in place.

I love Cad Management!