Jump to content

A non lisp way to populate a table with contents of text objects?


Recommended Posts

I'm prototyping a faster way to tabulate window heights on survey diagrams. We measure tops and bottoms of windows, but then show them in plan view.

 

 

Our drafties currently type the heights into a table. It occurred to me that there might be a way to pick the text objects (which contain the heights) one at a time and paste each value into the next row of a table.

 

 

Anyone got inspiration for where i could start with this? I'm looking for a non lisp solutions.

Link to comment
Share on other sites

Can you post an example, of the window drawing with text and a populated table, it always helps to see a problem, for example is it text, mtext or attributes.

Link to comment
Share on other sites

Thanks for the response steven. I know it's a long shot. Here's some more info.

 

 

attachment.php?attachmentid=56218&cid=1&stc=1

 

The orange text are all single line text objects. The lower numbers represent the elevation of the window sill, while the higher number represent the elevation of the window head.

 

And I have to type them in to a table like this:

attachment.php?attachmentid=56219&cid=1&stc=1

 

I already have a macro that stamps each window with an incrementing number when I go through and pick each window.

 

Sample drawing is attached. WindowTables.dwg

SingleLineText.PNG

WindowTable.PNG

Link to comment
Share on other sites

I know Steven is a wiz with LT but as per your PM if you had say Briscad you could do this so easy using just a block rather than a table pick window number pick text the "schedule" is updated, we do this for drainage pit schedules it matches the 1st id to the 1st attribute so it knows which block to populate the schedule can live anywhere in the drawing. As per image the info comes from about 4 different parts of the dwg.

 

ScreenShot032.jpg

Link to comment
Share on other sites

Interesting. How does it know how many rows to have in the block? For example, what if you have more pits than normal? Can the process add rows?

 

And do you use lisp to activate this?

 

Thanks for the ideas Bigal.

Link to comment
Share on other sites

My first responce, would be to suggest a block as Bigal has said (not sure about the link with Briscad ?). It should be possible to create a block that automatically increments a number as it is inserted and then fill in attribute values rather than using text, so it wouldn't read the existing text, it is an alternative method of working. The block information is easily changed, and can be read out to a csv file and imported into excel, from there it can be read back into Autocad as a table.

 

 

Without LISP or similar programming options, those of us with LT are limited to finding different methods of working so it would be doubtful that you could get it to be a single button solution.

My next question is, seeing your drawing there are 2 values for the sill level (which do you choose for the table)

How often do you need to create drawings like this - if it is all day, everyday, then there are certainly alternative options to save time (but they would take a while to setup, so not feasible for occasional use)

If this is a process that is often used, it would be helpful to know the actual process that you use now. How is the survey data collected, who enters it into the drawing, how it is entered etc.

Link to comment
Share on other sites

YZ its not that hard you have 1 block but inserted mutiple times into a plain linetype grid to look like a table so as many lines as you like, you have 1 attribute with a unique value in the example its the pit number, this is picked first in the code its a block or text, yes a bit of manual copy or edit pit number but if you look at the schedule there is like 15 columns of input and this info is not all in one place. The add next line is one of those things I need to do. The code supports text so in your case "Window-23" is ok.

 

Post a simple dwg I appreciate you only have LT but as you mentioned maybe a upgrade so why not to a Autocad alternative that supports lisp. Again 1 task 20 minutes now around 10 seconds you work out the dollars you save.

 

Public Sub ModifyPitSchedule2()
' puts in 1 pt x and y's plus length and width

Dim SS As AcadSelectionSet
Dim objENT As AcadEntity
Dim Count, Cntr As Integer
Dim Newpitname As String
Dim pitname As String
Dim FilterDXFCode(0) As Integer
Dim FilterDXFVal(0) As Variant
Dim PitNameSelect As AcadObject
Dim basepnt, pt1, pt2, pt3 As Variant
Dim attribs As Variant

On Error Resume Next

Newpitname = "1"   'dummy to pass then return changed

pitname = Getpitname(Newpitname)

MsgBox "pitname selected is " & pitname

basepnt = ThisDrawing.Utility.GetPoint(, " Pick PIT center ")


ptxtx1 = CStr(FormatNumber(basepnt(0), 3))
ptxty1 = CStr(FormatNumber(basepnt(1), 3))

pt1 = ThisDrawing.Utility.GetPoint(, " Pick 1st point ")

pt2 = ThisDrawing.Utility.GetPoint(, " pick 2nd point L ")

pt3 = ThisDrawing.Utility.GetPoint(, " pick 3rd point W ")

lx = Abs((pt1(0) - pt2(0)))
ly = Abs((pt1(1) - pt2(1)))
lz = Int((lx ^ 2 + ly ^ 2) ^ 0.5 * 10000) / 10
lengthpit = CStr(FormatNumber(lz, 0))

lx = Abs((pt2(0) - pt3(0)))
ly = Abs((pt2(1) - pt3(1)))
lz = Int((lx ^ 2 + ly ^ 2) ^ 0.5 * 10000) / 10
widthpit = CStr(FormatNumber(lz, 0))


'This will clear out old selectionsets, and prevent the "selection set already exists" error
If ThisDrawing.SelectionSets.Count > 1 Then
For Cntr = 0 To ThisDrawing.SelectionSets.Count - 1
ThisDrawing.SelectionSets.Item(Cntr).Delete
Next Cntr
End If

FilterDXFCode(0) = 0

FilterDXFVal(0) = "INSERT"
Set SS = ThisDrawing.SelectionSets.Add("pit2sel")
SS.Select acSelectionSetAll, , , FilterDXFCode, FilterDXFVal
BLOCK_NAME = "SCHEDTEXT"

For Cntr = 0 To SS.Count - 1
If SS.Item(Cntr).Name = BLOCK_NAME Then
  attribs = SS.Item(Cntr).GetAttributes
 
    If attribs(0).TextString = pitname Then
   
       attribs(1).TextString = ptxtx1
       attribs(2).TextString = ptxty1
       attribs(5).TextString = lengthpit
       attribs(6).TextString = widthpit
       
       attribs(1).Update
       attribs(2).Update
       attribs(5).Update
       attribs(6).Update
       Cntr = SS.Count
               
      End If
       
End If

Next Cntr
ThisDrawing.SelectionSets.Item("pit2sel").Delete
End Sub

Function Getpitname(Newpitname As String) As String

Dim PitNameSelect As AcadObject
Dim pitattribs As Variant


ThisDrawing.Utility.GetEntity PitNameSelect, basepnt, "pick pit name : "
If PitNameSelect.ObjectName = "AcDbText" Then
 Getpitname = PitNameSelect.TextString
End If

If PitNameSelect.ObjectName = "AcDbBlockReference" Then
 pitblname = PitNameSelect.Name   ' RETURNS BLOCK NAME
 pitattribs = PitNameSelect.GetAttributes
 Getpitname = pitattribs(0).TextString

End If


End Function

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