Arch Axis - Imperial Units and Offsets?

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Vert-Ex
Posts: 28
Joined: Wed Jan 01, 2020 6:58 pm

Arch Axis - Imperial Units and Offsets?

Post by Vert-Ex »

I'm trying to set up an axis/grid system to match an existing system on a set of a blueprints. First, the tool won't match the app or system units I have setup and only seems to accept millimeters for spacing. If I attempt to use imperial units (feet and inches), it throws an error:

10:51:15 Traceback (most recent call last):
10:51:15 File "C:\Program Files\FreeCAD 0.20\Mod\Arch\ArchAxis.py", line 743, in edit
10:51:15 self.resetObject()
10:51:15 File "C:\Program Files\FreeCAD 0.20\Mod\Arch\ArchAxis.py", line 756, in resetObject
10:51:15 d.append(float(it.text(1)))
10:51:15 ValueError: could not convert string to float: '15\' 6"'
10:51:18 Traceback (most recent call last):
10:51:18 File "C:\Program Files\FreeCAD 0.20\Mod\Arch\ArchAxis.py", line 743, in edit
10:51:18 self.resetObject()
10:51:18 File "C:\Program Files\FreeCAD 0.20\Mod\Arch\ArchAxis.py", line 756, in resetObject
10:51:18 d.append(float(it.text(1)))
10:51:18 ValueError: could not convert string to float: '15\' 6"'
11:08:28 Traceback (most recent call last):
11:08:28 File "C:\Program Files\FreeCAD 0.20\Mod\Arch\ArchAxis.py", line 743, in edit
11:08:28 self.resetObject()
11:08:28 File "C:\Program Files\FreeCAD 0.20\Mod\Arch\ArchAxis.py", line 756, in resetObject
11:08:28 d.append(float(it.text(1)))
11:08:28 ValueError: could not convert string to float: '31\' 1"'


Does anyone know of a way to change this so that it will accept imperial?

Also, there doesn't seem to be a way to space the axes using just offsets. For instance, if I have 10 grid lines on my blueprint ('1' through '10') along the horizontal axis all spaced evenly 20 feet apart, it's a real pain to have manually enter each 'axis' in FreeCAD in ascending multiples of 20. Is there a better to accomplish this?

Lastly, I just can't see it! Even when I do enter valid metric numbers and labels, I don't see any axes. What am I missing?
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: Arch Axis - Imperial Units and Offsets?

Post by Syres »

I've never needed to use this before so I had to lookup the Wiki entry https://wiki.freecad.org/Arch_Axis

So there does seem to be a bit of an omission with regard to the distances only being in millimetres so using the example script in the Wiki, I've knocked together that might make you life a little easier (possibly).

With an empty project file, copy the following into the Python Console and assuming you are still using the default background colour this should show up correctly (light blue):

Code: Select all

import Draft, Arch

iDistX = 48 # in inches
iDistY = 36 # in inches
iLength = 236.22 # in inches
iXNumOfAxes = 5
iYNumOfAxes = 6

Axes = Arch.makeAxis(iXNumOfAxes, iDistX*25.4)

Axes.ViewObject.LineWidth = 3
Axes.ViewObject.BubbleSize = 200
Axes.ViewObject.FontSize = 150
Axes.ViewObject.LineColor = (0.00,0.67,1.00)

FreeCAD.ActiveDocument.recompute()

Axes.Length = iLength*25.4

Axes2 = Arch.makeAxis(iYNumOfAxes, iDistY*25.4)

Axes2.ViewObject.LineWidth = 2
Axes2.ViewObject.BubbleSize = 200
Axes2.ViewObject.FontSize = 150
Axes2.ViewObject.NumberingStyle = "A,B,C"
Axes2.ViewObject.LineColor = (0.00,0.67,1.00)

FreeCAD.ActiveDocument.recompute()

Axes2.Length = iLength*25.4
Draft.rotate(Axes2, -90)
Draft.move(Axes2, FreeCAD.Vector(-(iDistX*25.4)/2, iDistY*25.4*iYNumOfAxes, 0))
FreeCAD.ActiveDocument.recompute()

Gui.SendMsgToActiveView("ViewFit")

If you then find it useful you can save it as a macro and just amend the five lines for distance, length and occurrences.

Code tested using:

Code: Select all

OS: Linux Mint 20.3 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.20.2.29603 (Git)
Build type: Release
Branch: (HEAD detached at 0.20.2)
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.10.8, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United Kingdom (en_GB)
Installed mods: 
  * ose-workbench-core
  * SearchBar 1.0.1
  * OSE3dPrinter
  * PieMenu 1.2.4
  * fasteners 0.4.54
Vert-Ex
Posts: 28
Joined: Wed Jan 01, 2020 6:58 pm

Re: Arch Axis - Imperial Units and Offsets?

Post by Vert-Ex »

This is very helpful, Syres, thanks for going through the trouble!
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: Arch Axis - Imperial Units and Offsets?

Post by paullee »

Moved to Arch forum. Any improvement could be done ?
Post Reply