vbdPowerSet problem
vbdPowerSet problem
(OP)
Im using the vbdPowerSet in a dvb project which collects user input and attribute values and inputs it into a database, then sends an email to certain parties (still finishing that part up). I'm trying to figure out how to modify this to only collect attribute values from the Current Tab. The plan is to prompt the user whether to process just the current tab or all tabs. I don't think I quite understand how the vbdPowerSet function and build filter sub works well enough to make this happen.
Any ideas?
Thanks in advance
Any ideas?
Thanks in advance
RE: vbdPowerSet problem
Your question has nothing to do with vbdPowerset, and only a little to do with BuildFilter.
What you're really after are the DXF codes to pass to your selection set.
The first thing you'll need to do, is get the current layout/tab name and save it in a variable.
The next thing you'll need is to build the right "query string" using the correct DXF code:
CODE
curLayoutName = ThisDrawing.ActiveLayout.Name
BuildFilter intData, varData, -4, "<and", _
0, "INSERT", _
410, curLayoutName, _
-4, "and>"
The next piece you need is "what if they want to process all the layouts?" You can do this one of two ways:
CODE
CODE
Either way will work - your choice.
HTH
Todd
RE: vbdPowerSet problem
I'm currently collecting attributes from only specific blocks from tab:
Set AcadDoc = ThisDrawing ' Current drawing.
BuildFilter intData, varData, -4, "<and", _
0, "INSERT", _
2, "DWG INFON", _
-4, "and>"
How would I add the specific block name to your code:
BuildFilter intData, varData, -4, "<and", _
0, "INSERT", _
410, curLayoutName, _
-4, "and>"
Thanks again for your reply!
D
RE: vbdPowerSet problem
Just like you got - just slide it in:
CODE
0, "INSERT", _
2, "DWG INFON", _
410, curLayoutName, _
-4, "and>"
The whole purpose of BuildFilter is to allow you an easy way to write those long complicated DXF filter codes in a somewhat orderly fashion - here's an example of one I used in another program:
CODE
-4, "<and", _
0, "INSERT", _
-4, "<or", _
70, 0, _
70, 2, _
-4, "or>", _
-4, "<not", _
2, "`*U#*,ADCADD_ZZ", _
-4, "not>", _
-4, "and>", _
-4, "<and", _
2, "`*U#*", _
-4, "*,*,<>", _
10, dblPnt, _
-4, "and>", _
-4, "or>"
HTH
Todd
RE: vbdPowerSet problem
There must be more to it than that though. When I insert 410, curLayoutName, _ The routine triggers
MsgBox "The PGS Drawing Information Block wasn't found."
I also tried replacing
curLayoutName = ThisDrawing.ActiveLayout.Name
with
curLayoutName = "100.01" (one of the tabs in my test drawing)
Finally I commented out
If ssTitleBlock.Count = 0 Then
'The title block wasn't found, notify the user and exit.
MsgBox "The PGS Drawing Information Block wasn't found."
End
End If
If ssTitleBlock1.Count = 0 Then
'The title block wasn't found, notify the user and exit.
MsgBox "The Release Block wasn't found."
End
End If
The routine ran, the email was sent, but nothing was written to the database.
RE: vbdPowerSet problem
Somewhere in your routine, I think I saw
CODE
CODE
CODE
CODE
Start there and make sure you've dotted all your "i's" and crossed all your "t's" in this regard first - if you don't, I don't know that you'll get all the properties, methods etc you need for the routine to work.
You didn't mention what version of AutoCAD your using, I've some issues with this not working on older versions of AutoCAD - I pretty sure the 410 code worked with at least 2004.
HTH
Todd
RE: vbdPowerSet problem
Tried it with the same result. If I just remove
410, curLayoutName, _
It runs perfectly.
I also tried using UserS1 instead of curLayoutName just in case it wasn't getting the current tab for some reason. That variable represents the current tab passed from the lisp routine I'm using to gather info and call up addrelease.dvb.
I'm running AutoCAD 2008.
Thanks,
David
RE: vbdPowerSet problem
Can you post what you've got? This should work.
RE: vbdPowerSet problem
www.pgsmillwork.com/post/release.zip Which contains the dvb file and lisp file which calls it up
Don't see how to directly attach a file.
Thanks!
RE: vbdPowerSet problem
I couldn't run the LISP routine it just errored out - it's been too long since I've done any LISP to fix it...
But, I did set USERI4 to 1 and then ran the ExportAttribsReleases macro and it did exactly as it was supposed to. I also added a couple of blocks and renamed them to your block names in the routine and they worked.
Have you tried it this way, I did notice your not checking for any blank/empty conditions when checking for USERIn. Not sure if that's the problem or not, and the other issue is I'm running 2009, I don't recall if there were any issues like you're having with 2008 but I doubt it. You might try adding/substituting this little snipet and then run it from VBAIDE and see if you get anything back:
CODE
'
If ssTitleBlock.Count = 0 Then
'The title block wasn't found, notify the user and exit.
MsgBox "The PGS Drawing Information Block wasn't found."
End
Else
Debug.Print "ssTitleBlock has " & ssTitleBlock.Count & " entities in it."
Debug.Print ssTitleBlock.Item(0).Name
Debug.Print "curLayoutName was " & curLayoutName
End If
If ssTitleBlock1.Count = 0 Then
'The title block wasn't found, notify the user and exit.
MsgBox "The Release Block wasn't found."
End
Else
Debug.Print "ssTitleBlock1 has " & ssTitleBlock1.Count & " entities in it."
Debug.Print ssTitleBlock1.Item(0).Name
Debug.Print "curLayoutName was " & curLayoutName
End If
End
At least you'll get a better idea where it's breaking.
HTH
Todd
RE: vbdPowerSet problem
I inserted your error trapping and still got the same msgbox result which would indicate that no blocks were detected.
I removed 410, curLayoutName, _
from
ElseIf UserI4 = "2" Then
BuildFilter intData1, varData1, -4, "<and", _
0, "INSERT", _
2, "Release2", _
410, curLayoutName, _
-4, "and>"
and it ran, but along with returning the values of current tab, and block name, it returned the count which was incorrect- it's getting the count from both tabs in this drawing instead of only from the current tab. So this must have to do with the selection set?
RE: vbdPowerSet problem
Now I'm wondering if it's something in your drawing, maybe a tab name, or the blocks themselves - these aren't xrefed in by any chance are they?
When I tested your routine I had inserted the blocks, not xrefed them, and had three tabs "Model", "Work", and "Work (2)".
I'm heading out to the airport shortly maybe you can post a drawing and I can try it with your drawing, probably won't be until Monday though...
RE: vbdPowerSet problem
Posted is
www.pgsmillwork.com/post/test.zip
I posted a drawing which has two tabs (its a mess because I'm in the process of changing the title block and some other things), my database (access), my "real" lisp routine and one called test which I've been using to quickly pass limited info to the dvb.
I'm thrilled that you are willing to help me out!
Have a good weekend.
David
RE: vbdPowerSet problem
Hope your weekend was good.
I took a look at your routine and it seems to be working, with the exception of this addtion/clean up I did to your ExportAttribsReleases routine:
CODE
'
Set AcadDoc = ThisDrawing ' Current drawing.
UserI4 = AcadDoc.GetVariable("UserI4")
UserS1 = AcadDoc.GetVariable("UserS1")
If UserS1 = "ALL" Then
curLayoutName = "*"
Else
curLayoutName = AcadDoc.ActiveLayout.Name
End If
I loaded both the release.lsp and the test.lsp but only ran the test.lsp routine. I was prompted for either (O)ne or (A)ll. If I typed "o", I got the current sheet information placed into the release table of the database. If I type "A", I got all the sheets' information in release table.
Maybe you just need to make these changes and it will work, I'm not sure at this point. The next issue might be whether or not you have all the service packs for AutoCAD installed or not. Also, just for grins, have you tried it on a different machine?
HTH
Todd
RE: vbdPowerSet problem
If I comment out the MSG BOX statements and run test.lsp I get:
ssTitleBlock has 0 entities in it.
ssTitleBlock has 0 entities in it.
curLayoutName was 100.01
ssTitleBlock1 has 0 entities in it.
curLayoutName was 100.01
In the Immediate pane.
Else If I don't comment out, I just get the message box. If I remove "410, curLayoutName, _" it runs and enters both sheets into the database. I have installed service pack one but have not installed the mirriad of hot fixes. Haven't had a chance to try it on another machine yet. I'll try that next I guess.
Seems so odd that the blocks are percieved unless the filter is applied. Makes me think it's something not right with either vbdPowerSet or BuildFilter, but that is probably my ignorrance!
I'm here today and tomorrow and then will be off for two weeks to Guyana and then Tobago for some fun! Hope I can crack it before then but if not it will be waiting when I get back. Thanks so much for your help.
David
RE: vbdPowerSet problem
Hope you figure it out - let us know how you do!
Todd
RE: vbdPowerSet problem
This has been bugging me so I went over to the Autodesk forum and found a few posts with your problem, check out this post: http://dis
HTH
Todd
RE: vbdPowerSet problem
It doesn't work on any 2008 machine here, but does work with 2009. Were you using 2009 as well? I'm not happy with the performance of 2009 but it looks like I'm going to have to roll it out to at lease a couple of users....
RE: vbdPowerSet problem
I am using 2009...
Todd