Skip to content

Instantly share code, notes, and snippets.

@romualdrichard
Last active April 19, 2024 08:40
Show Gist options
  • Save romualdrichard/22727a87cbec472354a691d5ed60933b to your computer and use it in GitHub Desktop.
Save romualdrichard/22727a87cbec472354a691d5ed60933b to your computer and use it in GitHub Desktop.
#jarchi script which is copying all the aspect of an element in a view and apply them in all the views for elements representing the same concept.
// This script copy appearance of the selected object to all the views of the model for this object.
// Function to copy properties from source to target visual object
function copyVisualObjectProperties(source, target) {
target.borderType = source.borderType;
target.deriveLineColor = source.deriveLineColor;
target.figureType = source.figureType;
target.fillColor = source.fillColor;
target.fontColor = source.fontColor;
target.fontName = source.fontName;
target.fontSize = source.fontSize;
target.fontStyle = source.fontStyle;
target.iconColor = source.iconColor;
target.image = source.image;
target.imageSource = source.imageSource;
target.imagePosition = source.imagePosition;
target.gradient = source.gradient;
target.labelExpression = source.labelExpression;
target.labelValue = source.labelValue;
target.lineColor = source.lineColor;
target.lineWidth = source.lineWidth;
target.opacity = source.opacity;
target.outlineOpacity = source.outlineOpacity;
target.refView = source.refView;
target.showIcon = source.showIcon;
target.specialization = source.specialization;
target.text = source.text;
target.textAlignment = source.textAlignment;
target.textPosition = source.textPosition;
}
console.clear();
var selectedVisualObject = $(selection).first();
console.log("Object : " + selectedVisualObject.name);
var myObject = selectedVisualObject.concept;
var visualObjects = $(myObject).objectRefs();
visualObjects.forEach(function(visualObject) {
copyVisualObjectProperties(selectedVisualObject, visualObject);
console.log("Change in view : " + visualObject.view.name);
});
console.log("Appearance applied");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment