OpenSCAD parser error when there is no visible error with the code - openscad

Code:
magnet_radius = 17.45/2; //for a 17.45mm diameter magnet
magnet_thickness = 3.90/2; //for a 3.90mm thick magnet
main_module();
module main_module(){
top_surface();
}
module top_surface(){
difference(){
cylinder(h=0.40, r1=magnet_radius*5, r2=magnet_radius*5);
cutaway();
}
module cutaway(){
cylinder(h=0.40, r1=magnet_radius*1.05, r2=magnet_radius*1.05);
}
It was working just a second ago. Now it's not working anymore. Please help.

You're missing a closing curly brace for "difference(){"

Related

ProgressBar framerate drops when Label draws on top

I'd not normally ask for help here, but I'm stumped - this bug is the strangest thing I've seen in a long time.
https://gfycat.com/FluidFrigidEastsiberianlaika
I've got a simple UI object called GhostProgressBar that extends ScalaFX.StackPane and gives it two children - a ProgressBar and a Label. I noticed after adding it to some other UI screens that my framerate had plummeted, to a point where the UI was painfully unusuable.
The code for this is super simple:
import scalafx.geometry.Pos
import scalafx.scene.control.{Label, ProgressBar}
import scalafx.scene.layout.StackPane
class GhostProgressBar extends StackPane {
alignment = Pos.Center
val bar = new ProgressBar() {
prefWidth = Integer.MAX_VALUE
}
val text = new Label() {
id = "ProgressBarText"
text = "PERFORMANCE TESTING"
}
children = List(bar, text)
}
In the GIF I'm using it inside a VBox that's the center element of a regular BorderPane - nothing strange or atypical.
From the behaviour I've observed, I think it's an issue with text being drawn over the bar of the ProgressBar. Just now I've done some more debugging, and my suspicions that it was related to the styling of the text were confirmed.
This is the styling that's on the text in the GIF.
#ProgressBarText {
-fx-text-fill: #dddddd;
-fx-font-weight: bold;
}
#ProgressBarText .text {
-fx-stroke: #333333;
-fx-stroke-width: 1px;
-fx-stroke-type: outside;
}
When I remove that styling, the framerate doesn't drop when the bar hits the text.
What I can't figure out is why this is happening? Anyone got any ideas? I have no idea if it's a Scala thing, or a ScalaFX thing, whether or not it's reproducible with the same stuff in a JavaFX context.
Help would be appreciated.
EDIT: I was asked for versions, here we go:
Scala version: 2.12.7
ScalaFX version: 8.0.102-R11
JDK version: 1.8.0_181
JavaFX version: unknown, I'm not familiar with ScalaFX's internals and I'm not using JavaFX directly.
EDIT 2: I was asked to try the same screen elements, but using JavaFX elements instead of ScalaFX ones. Here's the code I used, the outcome was the same - whenever the outlined text was over the progress bar's bar, the framerate dropped.
import javafx.geometry.Pos
import javafx.scene.control.{Label, ProgressBar}
import javafx.scene.layout.StackPane
class JavaFXGhostProgressBar extends StackPane {
this.setAlignment(Pos.CENTER)
val bar = new ProgressBar()
bar.setMaxWidth(Double.MaxValue)
val text = new Label()
text.textProperty().setValue("PERFORMANCE TESTING")
text.idProperty().setValue("OutlineProgressBarText")
this.getChildren.addAll(bar, text)
}
I couldn't find out what version of JavaFX I used here; IntelliJ was weirdly inconsiderate in not telling me. I couldn't find it in my external libraries list, either.

Prevent VS Code from changing indentation on Enter

Let's assume I have a JavaScript file with the following content and the cursor placed at the pipe symbol (|):
class ItemCtrl {
getPropertiesByItemId(id) {
return this.fetchItem(id)
.then(item => {
return this.getPropertiesOfItem(item);
});
}|
}
If I now hit enter, the code changes in the following way:
class ItemCtrl {
getPropertiesByItemId(id) {
return this.fetchItem(id)
.then(item => {
return this.getPropertiesOfItem(item);
});
}
|
}
It wrongly aligns the closing curly brace with the return statement, when it should be aligned with the method definition. I know that the formatting inside the function is not the best but I still would rather disable that feature to prevent weird things like that from happening.
I already set editor.autoIndent to false but it still keeps happening. Is there any other way, how I can turn this feature off entirely? (or make it work in a smarter way)
In VS Code 1.17, this bug caused "editor.autoIndent": false to not work
This should be fixed in VS Code 1.18

3DText - Change Text Through Script - Unity

I have read lot of questions on how to change text of a 3DText from script.
Lot of them suggested the following :::
GetComponent(TextMesh).text = "blah";
But when I try to use this, I get an error Expression denotes atype', where a variable',value' or method group' was expected
I tried a lot of examples and couldn't really get it to work.
TextMesh textMesh;
textMesh = (TextMesh) descriptionObject.transform.GetComponent("Text Mesh");
textMesh.text = "Name : ABC";
The above code though Compiles without errors doesn't change the text. Can someone help me out with this? How do I change the TEXT of a 3DText Object.
Thanks...
This would be a prettier solution than one already given(C# script used in example) :
//define a Textmesh that we want to edit
public TextMesh tm;
// here in start method (run at instantiating of script) i find component of type
// TextMesh ( <TextMesh> ) of object named"nameOfTheObject" and reference it
// via tm variable;
void Start () {
tm = (TextMesh)GameObject.Find ("nameOfTheObject").GetComponent<TextMesh>();
// here we change the value of displayed text
tm.text = "new Text u want to see";
}
Or if u want to do it the shortest way possible (syntax wise):
//keep in mind this requires for the script to be attached to the object u
// are editing (the 3dText);
//same as above, the only difference is the note in the line above as this
// method is run from gameObject.GetComponent....
// gameObject is a variable which would be equivalent of this.GetComp...
// in some other programming languages
GetComponent<TextMesh>().text ="new Text u want";
This Works !!!!
textMesh = (TextMesh) descriptionObject.transform.GetComponent(typeof(TextMesh));
textMesh.text = "Name : ABC";

error when opening video in titanium

I've been working in Titanium appaccelerator and now I'm trying to open a video in it.
I've used the following code:
movieWindow.js
function displayVideo()
{
var window = Ti.UI.createWindow({
width:200,
height:300,
});
var activeMovie = Titanium.Media.createVideoPlayer({
url:"respigrandsoupir.mp4",
width:300,
height:200,
top:50,
left:50,
backgroundColor:'#0f0'
});
window.add(activeMovie);
activeMovie.play();
return window;
}
My video respigrandsoupir.mp4 is under the Resource folder. The problem is that when trying to run this method I get the following error:
[WARN] Exception in event callback. { expressionBeginOffset = 159;
expressionCaretOffset = 173;
expressionEndOffset = 191;
line = 12;
message = "Result of expression 'Titanium.Media' [undefined] is not an object.";
name = TypeError;
sourceId = 238167336;
sourceURL = "file://localhost/Users/adrian/Documents/Titanium%20Studio%20Workspace/La%20Pause/Resources/movieWindow.js";
}
Can one tell me where am I going wrong?
Thank you for your valuable answers, but Project->Clean solved my issue!
When you use a new object like Titanium.Media that you never used before, a clean is often required because Titanium builds a custom light version in the target folder.
If you don't clean, it will search in vain the widget in this folder.

Coverage map with Drupal, GMap and Location

I'm using the GMaps, Location and User locations module on my Drupal site. I would like to have a map which can display the "coverage" of my users. The coverage radius is stored in a custom content type with reference to the user.
How is it possible to display users with only their coverage circle on a map? I saw a display type like this when playing with the GMap macros, so I think it would be possible to use GMaps that way.
I suppose most likely this isn't supported out-of-the-box with the GMap module. Anyway, I would be really glad if anybody could point me into the right direction...
I've managed to do this after all with the help of the Hungarian community. (I would be happy to link the original thread, but it seems it got deleted.)
Basically the "trick" was to make a little custom module with a hook:
function MODULENAME_preprocess_gmap_view_gmap(&$vars) {
if ( $vars['view']->name == "my_gmap_view" ) {
$map_object = $vars['map_object'];
$map_object['id'] = 'my_view_id';
foreach ($vars['view']->result as $key => $row) {
$shapes[$key]['type'] = 'circle';
// we have a profile field for the radius, but it could be anything...
$shapes[$key]['radius'] = $row->profile_values_profile_radius_value;
// center the circles on the coord
$shapes[$key]['center'][0] = $row->location_latitude;
$shapes[$key]['center'][1]= $row->location_longitude;
}
// we don't need any markers, just the circles
$map_object['markers'] = NULL;
$map_object['shapes'] = $shapes;
$vars['map'] = theme('gmap', array('#settings' => $map_object));
}
}