Forum: Ruby Ruby for TurboCad

503b861c1ea3bcd8d3614a6a8f988c45?d=identicon&s=25 Steve Bradley (elcobar)
on 2014-02-19 19:13
Okay, look at this little app.  This is from TurboCAD, and does nothing
more than draw a rectangle.  I need to draw columns, beams, etc.  A
column drawing app should get baseplate dimensions, holes in the plate,
column size and length, maybe the cap plate size, maybe anchor bolt size
and dimensions, and should draw two or three views, hidden lines, center
lines, etc.

This app could be modified, but the user input has to be far more
extensive.

I'm busy drawing.  I tried to post the file, but keep getting a error
message. Would anyone like to help out on this?

Elcobar

# TCAPIRectangle.rb

# load the libraries
  require 'system.xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
  require 'PresentationFramework, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'
  require 'PresentationCore, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'
  require 'windowsbase, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'
include System::Windows::Markup;

def tc_rectangle_test
  # load the xaml file
  window = UI.LoadXaml("RectangleWPFSample.xaml")

  # get the controls
  button = window.find_name('drawBox')
    if button == nil then
      puts "drawBox button control not found. Check name spelling in
xaml file."
      exit
    end
  length1 = window.find_name('length1')
    if length1 == nil then
      puts "length1 text control not found. Check name spelling in xaml
file."
      exit
    end
  height1 = window.find_name('height1')
    if height1 == nil then
      puts "height1 text control not found. Check name spelling in xaml
file."
      exit
    end

  # Handle button click
  button.click do |sender, args|
    puts "length1: " + length1.Text
    puts "height1: " + height1.Text
    ents = TCApplication.ActiveDrawing.Graphics
    ents.AddLineRectangle(0, 0, 0,
System::Convert.ToDouble(length1.Text),
System::Convert.ToDouble(height1.Text), 0)
    window.Close
  end

  window.Show

end
#Run
UI.menu("Plugins").add_item("TC Rectangle"){tc_rectangle_test}
Abdb670e1c130f96f947a94d03c02efa?d=identicon&s=25 Eric Christopherson (echristopherson)
on 2014-02-20 08:39
(Received via mailing list)
On Wed, Feb 19, 2014 at 12:13 PM, Steve Bradley
<lists@ruby-forum.com>wrote:

> I'm busy drawing.  I tried to post the file, but keep getting a error
> PublicKeyToken=31bf3856ad364e35'
>   require 'PresentationCore, Version=3.0.0.0, Culture=neutral,
> PublicKeyToken=31bf3856ad364e35'
>   require 'windowsbase, Version=3.0.0.0, Culture=neutral,
> PublicKeyToken=31bf3856ad364e35'
> include System::Windows::Markup;
>

[snip]

What is the error?

Also, this looks like IronRuby; you might want to ask on a forum or
mailing
list dedicated to that implementation.
503b861c1ea3bcd8d3614a6a8f988c45?d=identicon&s=25 Steve Bradley (elcobar)
on 2014-02-20 15:49
Eric Christopherson wrote in post #1137312:
> On Wed, Feb 19, 2014 at 12:13 PM, Steve Bradley
> <lists@ruby-forum.com>wrote:
>
>> I'm busy drawing.  I tried to post the file, but keep getting a error
>> PublicKeyToken=31bf3856ad364e35'
>>   require 'PresentationCore, Version=3.0.0.0, Culture=neutral,
>> PublicKeyToken=31bf3856ad364e35'
>>   require 'windowsbase, Version=3.0.0.0, Culture=neutral,
>> PublicKeyToken=31bf3856ad364e35'
>> include System::Windows::Markup;
>>
>
> [snip]
>
> What is the error?
>
> Also, this looks like IronRuby; you might want to ask on a forum or
> mailing
> list dedicated to that implementation.


The error is unimportant, but it had to do with a failure to accept a
file upload.

Thanks for the info about IronRuby.  I will look for that forum.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.