Autocad- get to the field edit value of a block attribute

Well, this was like looking for a needle in a haystack. I tried to use google to know if a block attribute referred to text or to a formula that made the text. The key is looking at the extension dictionary. If there is one, it has dictionaries inside of them and if one of the items in named “ACAD_FIELD” then… yes this attribute is de-referenced or aliased or abstracted by using a formula. I was usinging the attributes .Text property which gives you the RESULT of the field formula underneath. I was doing search and replaces and blowing away the formulas – which would have been best left alone. Now I can skip them.

The guy here about 8 posts down AFTER reading the code was my hero on this one. It was after about 20 google searches.

Continue reading

Getting the user to pick an Excel cell range via a dialog …

I have made a couple tools with setup variables that I wish to keep in Excel and not really accessible to the end user per-se. So I use named ranges. However, rather than type up elaborate setup documents for a spreadsheet – the end user said “can I get a helper routine to fill all these in?”. Yes was the answer ONLY IF we could have the user pick selection ranges. So – using userforms and the Application.InputBox … I think we can! Here’s how… Continue reading

XML to drive very generic queries

So I had the idea for a project that the easiest way to get some customization into a dB driven system is to use XML – but that would require an engine being built in some platform. Most of the horsepower for his part of the project is in SQL server. So I went surfing. Here is an article by a sheer genius Wayne Ackman who is doing what I require -> XML to SQL statements being executed.

The only thing I have to do is to ensure that primary key can be overridden in a very generic way for an update. Other than that it is perfect.

SQL Connections, Drivers and ODBC drive me crazy. Here is one that worked. Import to Excel from SQL Server

What I am rying to do is use a stored proc in SQL Server and feed it some parameters making it dynamic. What the stored proc does is a query to an excel spreadsheet and compares whats different in a SQL database. The crazy part was that

  • using ADODB in VBA worked once under certain conditions,
  • MSQuery works in others and …
  • doing it with eh Import Data Wizard from the Data tab for SQL Server did NOT work – which is the one you would expect WOULD work best (the native one)

So – I noticed that MSQuery worked Continue reading

VBA Classes 101 links

I often have to refer to this so here are some bookmarks to remember.

  • this is a good primer once you have the over all syntax. I uses classes often – just not my own so much in VBA since the application is different. I usually do “get in -= do = get out” programming in VBA.
  • mix it together with this syntax from top to bottom and … voila. Instant class.
  • For private properties, you cannot prefix with an _ or underscore. That is too bad but p_ will do just fine.

AutoCad copy/paste to and From Excel

I am not sure why this seems so hard – there must be a good reason that I don’t understand, but upon a copy/paste to and from Excel, it is seems oddly strange that AutoCAD does not auto-translate into the standard that is common across the whole world. I know one can link and some other shortcuts, but  mostly , designers want to just get info in and out of AutoCAD.

Anyways, here are some links that I followed to to make routines to copy/paste to and from Excel easily.

 

Drive Space getting you down – automate it…

Drive Space for local backups (local mean QUICK backups) can get ownerous and it constantly needs user interaction. Well lets put a stop to that and fullfill a dream I have.

  1. a) cull either on a date or file limit basis
  2. b) cull rules are to keep
  • last item in the year
  • last item in the month
  • last day in the week
  • last hour in the day

So a way to start is to simply

  • make a file list
  • mark the end of all the years, months, weeks, days and hours
  • delete all else until our time or date criteria is met

Lets get going … Continue reading