TheSwamp
Code Red => .NET => Topic started by: Yosso on February 28, 2014, 08:40:51 AM
-
Is Mr. Winters still supporting his book "VB.NET for AutoCAD 2010"?
The VBcad.com website took my money and sent me the book, no problem.
I obtained the book, and have found it extremely helpful, but am having some issues with one of the code snippets.
An e-mail was sent to the contact e-mail, but no reply was received. (It has been only two days).
So, does anybody know if Mr. Winter's is still providing support, as stated in the book, or has that time passed?
Thank you for your time in this matter.
M.
-
Don't know, but things have changed significantly in both dotNET and AutoCAD in the meantime to the point where a lot of the code details would be suspect, or at least require some migration.
-
Does he have a web site? If so, I would check there first for "support".
-
There are a lot of very smart people on this forum and if you posted the code that you need support with here then you will likely get some very good suggestions on how to tackle the issues you are having.
-
There are a lot of very smart people on this forum ...
Who you calling smart? You take that back now mister! :-D :lol:
-
I got the book and seen others complain about customer service or no reply to support. Seems like I asked for code examples and email 3 months later, but will give some info on API but would not take suggestions about general programming concepts, etc... in book.
-
Does he have a web site? If so, I would check there first for "support".
VbCad.com
He has seminar that you can sign up for at website
June 11 - 14th, 2012 in Salt Lake City
Maybe get info there.
-
I got the book and seen others complain about customer service or no reply to support. Seems like I asked for code examples and email 3 months later, but will give some info on API but would not take suggestions about general programming concepts, etc... in book.
When I was first interested in learning .NET development, I took an AU Online course he taught. I emailed him just after 2011 came out, asking if he was going to be releasing a new book, etc. He never replied, which led to my not purchasing his book at all.
Instead, I purchased a book by Andrew Troelsen, and switched to C#... Haven't looked back since (mostly because of how ugly my early code was, etc.). :-D
-
The website is dated and very old-school. Not to mention all of the dates are past their expiration.
Guess I should have asked for feedback before purchasing the book. :lol:
Oh well, thank you for the feedback (better late than never).
M.
-
Which sample are you having problems with?
-
Which sample are you having problems with?
That sounds like theSwamp attitude !
-
Which sample are you having problems with?
I'll post the specific code, when I'm back at work tomorrow (or Monday). The code sample was dealing with dynamic blocks - I'm wanting to flip a visibility state of a block in a folder full of drawings - so I'm trying to learn from Mr. Winter's code and learn VB.net.
Our firm's programmer is no longer of this world, and we have several VBA ACAD (with forms) programs that I need to convert to VB.net, so for practice I'm trying to write the dynamic block processing program mentioned above.
Thank you for your offer of assistance and have a great weekend.
M.
-
Insert block code...
Public Function InsertBlock(ByVal DatabaseIn As Database, _
ByVal BTRToAddTo As String, _
ByVal InsPt As Geometry.Point3d, _
ByVal BlockName As String, _
ByVal XScale As Double, _
ByVal YScale As Double, _
ByVal ZScale As Double) As DatabaseServices.ObjectId
Using myTrans As Transaction = DatabaseIn.TransactionManager.StartTransaction
Dim myBlockTable As BlockTable = _
DatabaseIn.BlockTableId.GetObject(OpenMode.ForRead)
'If the suppplied Block Name is not
'in the specified Database, get out gracefully.
If myBlockTable.Has(BlockName) = False Then
Return Nothing
End If
'If the specified BlockTableRecord does not exist,
'get out gracefully
If myBlockTable.Has(BTRToAddTo) = False Then
Return Nothing
End If
Dim myBlockDef As BlockTableRecord = _
myBlockTable(BlockName).GetObject(OpenMode.ForRead)
Dim myBlockTableRecord As BlockTableRecord = _
myBlockTable(BTRToAddTo).GetObject(OpenMode.ForWrite)
'Create a new BlockReference
Dim myBlockRef As New BlockReference(InsPt, myBlockDef.Id)
'Set the scale factors
myBlockRef.ScaleFactors = New Geometry.Scale3d(XScale, YScale, ZScale)
'Add the new BlockReference to the specified BlockTableRecord
myBlockTableRecord.AppendEntity(myBlockRef)
'Add the BlockReference to the BlockTableRecord.
myTrans.AddNewlyCreatedDBObject(myBlockRef, True)
Dim myAttColl As DatabaseServices.AttributeCollection = _
myBlockRef.AttributeCollection
'Find Attributes and add them to the AttributeCollection
'of the BlockReference
For Each myEntID As ObjectId In myBlockDef
Dim myEnt As Entity = myEntID.GetObject(OpenMode.ForRead)
If TypeOf myEnt Is DatabaseServices.AttributeDefinition Then
Dim myAttDef As DatabaseServices.AttributeDefinition = myEnt
Dim myAttRef As New DatabaseServices.AttributeReference
myAttRef.SetAttributeFromBlock(myAttDef, myBlockRef.BlockTransform)
myAttColl.AppendAttribute(myAttRef)
myTrans.AddNewlyCreatedDBObject(myAttRef, True)
End If
Next
myTrans.Commit()
Return myBlockRef.Id
End Using
End Function
Error Log:
Step into: Stepping over non-user code 'Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase.get'
A first chance exception of type 'System.NullReferenceException' occurred in DynBlockVisibility.dll
Crash message from AutoCAD:
(http://i138.photobucket.com/albums/q245/yosso22/insertblock-crash_zps88fba429.jpg) (http://s138.photobucket.com/user/yosso22/media/insertblock-crash_zps88fba429.jpg.html)
-
Hi,
Looking at the Error log it seems that the DatabaseIn argument is null when calling the InsertBlock() function.
If so the error is in the calling method where the database is not instanciated.
PS: Why VB coders prefix all the local variables with "my" ? It makes the code completely indigestible !
-
PS: Why VB coders prefix all the local variables with "my" ? It makes the code completely indigestible !
How else to distinguish between yourVariable?? :ugly: :lmao:
-
< .. >
PS: Why VB coders prefix all the local variables with "my" ? It makes the code completely indigestible !
Slightly better than using "his".
That would be really confusing as well as unpalatable.
-
Hi,
Looking at the Error log it seems that the DatabaseIn argument is null when calling the InsertBlock() function.
If so the error is in the calling method where the database is not instanciated.
< .. >
Yes, that is what it looks like.
Yosso,
What version of AutoCAD are you programming for.
Does the 'book' make allowance for the changes related to AcCoreMgd introduced in AC2013
http://through-the-interface.typepad.com/through_the_interface/2012/03/migrating-net-applications-to-work-with-autocad-2013.html
-
Hi,
Looking at the Error log it seems that the DatabaseIn argument is null when calling the InsertBlock() function.
If so the error is in the calling method where the database is not instanciated.
< .. >
Yes, that is what it looks like.
Yosso,
What version of AutoCAD are you programming for.
2014/2013
Does the 'book' make allowance for the changes related to AcCoreMgd introduced in AC2013
http://through-the-interface.typepad.com/through_the_interface/2012/03/migrating-net-applications-to-work-with-autocad-2013.html
I'll take a look at the posting tonight, thanks for the link. :-D