How To set AutoCAD Text Width Factor with Script

So, you’re writing a script for AutoCAD and you’re going to write some text. That’s great, you know how to do it. Even if you don’t you can follow along in the command line and figure it out.

Now, what if you wanted to control the Width Factor, or back it upside down or backwards? This is under the STYLE command. Once you know that It’s relatively simple to follow along in the command line but I’ll enumerate here.

-style Font Style Height WidthFactor Angle Backwards UpsideDown Vertical
To write some Standard text at the origin, with 80% width factor I would use it like this.

-style Standard Simplex 0.125 0.8 0 N N N
;Set the Style
-text 0,0,0 .125 0 Hello World
;Write your text
-style Standard Simplex 0.125 1 0 N N N
;Good practice to set the style back

I hope this has helped you. Good luck in your efforts!

Changing the order of AutoCAD Block Attributes

I ran into an issue at work that took me a while to solve. Here is my solution.

I created some custom Blocks in AutoCAD with several Attribute fields. I decided to reorder them but found the process unintuitive and even web searching didn’t help much. After I figured out how to do it I slept and forgot again. In order to remember I am writing it down and sharing it with you.

I am using Autodesk AutoCAD 2018 but I expect most versions will have a similar solution.

  • Open the block you wish to revise
  • From the Insert tab Select Block Editor, double-click on
  • Type command BATTORDER
  • Make changes as desired
  • Select Close Block Editor, confirm Save the changes to <Current Drawing>
  • Save file.

If you know of a simpler way I would love to hear about it.

Recover Audacity project from .au data files

In this post I tell you how to recover an Audacity project from the data files when all feels lost.

Quick introduction. Audacity is a free, open source audio recording program. It  works well and has useful features. The way it works, similar to other software, is while recording it saves a file every 6 seconds to keep from generating a giant audio file in memory. These are .au files.

Then, the program saves a .aup file which is essentially a playlist for the software to know which order to replay those files. There is a little more but that’s the basic idea.

If, for some reason, the .aup file fails to save you will feel despondent and helpless. Especially if you recorded an hour and a half interview that now appears to be completely lost. A search online for help in solving your problem will not leave you feeling better, unless you came here first.

For some reason, Audacity does not save the .au files with sequential filenames, they are random. This is a problem if you need to put them back in order. Note to developers, please change this.

For this solution I am using Audacity 2.1.xx. Navigate to the folder location for the project. Inside you should find a series of numbered folders each with approximately 256 .au files. Starting with the first sub-folder, follow these steps.

    1. Sort the folder by date created
    2. Rename so that files are sequentially named, either with bulk rename and brute force or with PowerShell or similar bulk renaming tool.
    3. In Audacity File–>Import–>Audio–> Select all the files (Do this in batches, limit to under 1000, preferable the 256 that Audacity separates folders into)
    4. Wait while it churns
    5. Ctrl+A to select all the tracks
    6. Tracks–>Align Tracks–>Align End to End
    7. Ctrl+A to select all the tracks
    8. Tracks–>Mix–>Mix and render
    9. Wait while it churns
    10. Export WAV or MP3 (name this after it’s folder so you know what order they go in)
    11. Repeat for each sub-folder

Combine these into a new file with the same Align/Mix actions as before and export as your filetype of choice.

I hope that this has helped even just one person. Have a great day!

Bookmarklets

I’m a big fan of using Bookmarklets. These little bits of code make some tedious tasks easier. I posted a few of my favorites here but I have a new one to add.

javascript:void(window.open('http://fakespot.com/analyze?utf8=' + encodeURIComponent('✓') + '&url=' + encodeURIComponent(location.href) + '&commit=Analyze'))

This one checks Amazon reviews at FakeSpot.com to give you a sense if that average 4.5 star rating on a questionable buy is from real people or likely to be paid reviews.

 

WordPress Featured Image

I wanted to modify the way WordPress was displaying my featured image for posts. The desired function is the image shown thumbnail size, to the right on the main page or search results and be a link to the post page. Then, on the post page, remain thumbnail sized and be a link to the full size image. To do this I edit content.php in two places. First, comment out the thumbnail code around line 20 and insert the below code directly after. You will have to repeat this after updating WordPress because this file is overwritten.
<!--Moved Featured Image Start-->

<!–Remember to comment out thumbnail above–>

<a href=”
<?php
if ( is_home() ) {
// This is the blog posts index
the_permalink();
} else {
// This is not the blog posts index
if ( has_post_thumbnail() ) {
$full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ );
echo $full_image_url[0] . ‘” title=”‘ . the_title_attribute( ‘echo=0’ );
//echo get_the_post_thumbnail( $post->ID, ‘medium’ );
}
}
?>
“>

<?php if ( ! post_password_required() && ! is_attachment() ) :
the_post_thumbnail(‘thumb’);
endif; ?></a>
<!–Moved Featured Image End–>

ELBC, Part 159

I am so far behind. Sorry.

2015-01-06
11 cents
Total: $0.11
2015-01-11
1 cent
Total: $0.01
2015-01-12
5 cents
Total: $0.05
2015-01-23
2 cents
1 nickel
Total: $0.07
2015-01-27
1 cent
Total: $0.01
2015-01-28
1 cent
1 dime
Total: $0.11
2015-02-03
1 cent
Total: $0.01
2015-02-04
1 cent
Total: $0.01
2015-02-05
1 nickel
Total: $0.05
2015-02-06
1 cent
1 dime
Total: $0.11
2015-02-09
2 cents
Total: $0.02
2015-02-10
7 cents
Total: $0.07
2015-02-23
1 quarter
Total: $0.25
2015-02-24
3 cents
Total: $0.03
2015-02-25
2 cents
1 nickel
Total: $0.07
2015-02-26
1 cent
1 dime
Total: $0.11
2015-02-27
4 cents
Total: $0.04
2015-03-02
1 cent
Total: $0.01
2015-03-03
1 cent
Total: $0.01
2015-03-04
36 cents
Total: $0.36
2015-03-07
1 cent
Total: $0.01
2015-03-08
1 cent
Total: $0.01
2015-03-09
1 cent
1 dime
Total: $0.11
2015-03-24
2 cents
Total: $0.02
2015-03-30
1 cent
Total: $0.01
2015-03-31
1 cent
1 dime
Total: $0.11
2015-04-10
1 quarter
Total: $0.25
2015-04-22
1 cent
Total: $0.01
2015 Cumulative: $2.04

Overall Cumulative: $50.87 Loose Change